Commit 66392177eb
Unsigned
Layout: unified · split
src/commands.rs +20 −5
| @@ -247,12 +247,27 @@ Use /matrix [command] help to find out more.\n", | ||
| 247 | 247 | |
| 248 | 248 | match matches.subcommand() { |
| 249 | 249 | ("connect", Some(subargs)) => { |
| 250 | weechat.print("Connecting"); | |
| 250 | let server_names = subargs.values_of("name") | |
| 251 | .expect("Server names not set but were required"); | |
| 252 | ||
| 251 | 253 | let mut servers = servers.borrow_mut(); |
| 252 | for server in servers.values_mut() { | |
| 253 | match server.connect() { | |
| 254 | Ok(_) => (), | |
| 255 | Err(e) => weechat.print(&format!("{:?}", e)), | |
| 254 | ||
| 255 | for server_name in server_names { | |
| 256 | let server = servers.get_mut(server_name); | |
| 257 | if let Some(s) = server { | |
| 258 | match s.connect() { | |
| 259 | Ok(_) => (), | |
| 260 | Err(e) => weechat.print(&format!("{:?}", e)), | |
| 261 | } | |
| 262 | } else { | |
| 263 | weechat.print(&format!( | |
| 264 | "{}{}: Server \"{}{}{}\" not found.", | |
| 265 | weechat.prefix("error"), | |
| 266 | PLUGIN_NAME, | |
| 267 | weechat.color("chat_server"), | |
| 268 | server_name, | |
| 269 | weechat.color("reset") | |
| 270 | )); | |
| 256 | 271 | } |
| 257 | 272 | } |
| 258 | 273 | } |