Commit 937494a040
Unsigned
Layout: unified · split
src/commands.rs +22 −1
| @@ -51,6 +51,25 @@ Use /matrix [command] help to find out more.\n", | ||
| 51 | 51 | Commands { _matrix: matrix } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | fn list_servers(servers: &Servers) { | |
| 55 | let weechat = unsafe { Weechat::weechat() }; | |
| 56 | ||
| 57 | if servers.borrow().is_empty() { | |
| 58 | return; | |
| 59 | } | |
| 60 | ||
| 61 | weechat.print("\nAll Matrix servers:"); | |
| 62 | ||
| 63 | // TODO print out some stats if the server is connected. | |
| 64 | for server in servers.borrow().keys() { | |
| 65 | weechat.print(&format!( | |
| 66 | " {}{}", | |
| 67 | weechat.color("chat_server"), | |
| 68 | server | |
| 69 | )); | |
| 70 | } | |
| 71 | } | |
| 72 | ||
| 54 | 73 | fn server_command( |
| 55 | 74 | args: &ArgMatches, |
| 56 | 75 | servers: &Servers, |
| @@ -140,7 +159,9 @@ Use /matrix [command] help to find out more.\n", | ||
| 140 | 159 | weechat.color("reset") |
| 141 | 160 | )); |
| 142 | 161 | } |
| 143 | _ => (), | |
| 162 | ||
| 163 | ("list", _) => Commands::list_servers(servers), | |
| 164 | _ => Commands::list_servers(servers), | |
| 144 | 165 | } |
| 145 | 166 | } |
| 146 | 167 | |