Commit a95880aa86
Unsigned
Layout: unified · split
src/lib.rs +12 −8
| @@ -95,18 +95,22 @@ impl WeechatPlugin for Matrix { | |||
| 95 | config: config.clone(), | 95 | config: config.clone(), |
| 96 | }; | 96 | }; |
| 97 | 97 | ||
| 98 | spawn_weechat(async move { | 98 | { |
| 99 | { | 99 | let config_borrow = config.borrow(); |
| 100 | let config = config.borrow(); | 100 | if config_borrow.read().is_err() { |
| 101 | config.read().expect("Can't read config"); | 101 | return Err(weechat::Error(-1)); |
| 102 | } | 102 | } |
| 103 | } | ||
| 103 | 104 | ||
| 104 | let mut servers = servers.borrow_mut(); | 105 | { |
| 105 | 106 | let mut servers_borrow = servers.borrow_mut(); | |
| 106 | if servers.is_empty() { | 107 | if servers_borrow.is_empty() { |
| 107 | Matrix::create_default_server(&mut servers, &config) | 108 | Matrix::create_default_server(&mut servers_borrow, &config) |
| 108 | } | 109 | } |
| 110 | } | ||
| 109 | 111 | ||
| 112 | spawn_weechat(async move { | ||
| 113 | let mut servers = servers.borrow_mut(); | ||
| 110 | Matrix::autoconnect(&mut servers); | 114 | Matrix::autoconnect(&mut servers); |
| 111 | }); | 115 | }); |
| 112 | 116 | ||