Commit 837814f544
837814f54447813efc77a44b78111a4243ac0884
parent: ea5537e287
Unsigned
Damir Jelić <poljar@termina.org.uk> · 2020-07-18 15:48 UTC
weechat-matrix: Update the command creation.
Layout: unified · split
Cargo.lock
+3 −3
| @@ -2203,7 +2203,7 @@ dependencies = [ |
| 2203 | [[package]] |
2203 | [[package]] |
| 2204 | name = "weechat" |
2204 | name = "weechat" |
| 2205 | version = "0.1.0" |
2205 | version = "0.1.0" |
| 2206 | source = "git+https://github.com/poljar/rust-weechat#7defc24d659aa920d519f47e7cb25982926647a9" |
2206 | source = "git+https://github.com/poljar/rust-weechat#18675e3fafee2ddcd4e682e4b9d1768e8cfed982" |
| 2207 | dependencies = [ |
2207 | dependencies = [ |
| 2208 | "async-task", |
2208 | "async-task", |
| 2209 | "async-trait", |
2209 | "async-trait", |
| @@ -2219,7 +2219,7 @@ dependencies = [ |
| 2219 | [[package]] |
2219 | [[package]] |
| 2220 | name = "weechat-macro" |
2220 | name = "weechat-macro" |
| 2221 | version = "0.1.0" |
2221 | version = "0.1.0" |
| 2222 | source = "git+https://github.com/poljar/rust-weechat#7defc24d659aa920d519f47e7cb25982926647a9" |
2222 | source = "git+https://github.com/poljar/rust-weechat#18675e3fafee2ddcd4e682e4b9d1768e8cfed982" |
| 2223 | dependencies = [ |
2223 | dependencies = [ |
| 2224 | "libc", |
2224 | "libc", |
| 2225 | "proc-macro2", |
2225 | "proc-macro2", |
| @@ -2246,7 +2246,7 @@ dependencies = [ |
| 2246 | [[package]] |
2246 | [[package]] |
| 2247 | name = "weechat-sys" |
2247 | name = "weechat-sys" |
| 2248 | version = "0.1.0" |
2248 | version = "0.1.0" |
| 2249 | source = "git+https://github.com/poljar/rust-weechat#7defc24d659aa920d519f47e7cb25982926647a9" |
2249 | source = "git+https://github.com/poljar/rust-weechat#18675e3fafee2ddcd4e682e4b9d1768e8cfed982" |
| 2250 | dependencies = [ |
2250 | dependencies = [ |
| 2251 | "bindgen", |
2251 | "bindgen", |
| 2252 | "libc", |
2252 | "libc", |
src/commands.rs
+3 −4
| @@ -267,7 +267,6 @@ impl CommandCallback for MatrixCommand { |
| 267 | |
267 | |
| 268 | impl Commands { |
268 | impl Commands { |
| 269 | pub fn hook_all( |
269 | pub fn hook_all( |
| 270 | weechat: &Weechat, |
| |
| 271 | servers: &Servers, |
270 | servers: &Servers, |
| 272 | config: &ConfigHandle, |
271 | config: &ConfigHandle, |
| 273 | ) -> Result<Commands, ()> { |
272 | ) -> Result<Commands, ()> { |
| @@ -293,14 +292,14 @@ Use /matrix [command] help to find out more.\n", |
| 293 | .add_completion("reconnect") |
292 | .add_completion("reconnect") |
| 294 | .add_completion("help server|connect|disconnect|reconnect"); |
293 | .add_completion("help server|connect|disconnect|reconnect"); |
| 295 | |
294 | |
| 296 | let matrix = weechat.hook_command( |
295 | let matrix = Command::new( |
| 297 | matrix_settings, |
296 | matrix_settings, |
| 298 | MatrixCommand { |
297 | MatrixCommand { |
| 299 | servers: servers.clone(), |
298 | servers: servers.clone(), |
| 300 | config: config.clone(), |
299 | config: config.clone(), |
| 301 | }, |
300 | }, |
| 302 | ); |
301 | )?; |
| 303 | |
302 | |
| 304 | Ok(Commands { _matrix: matrix? }) |
303 | Ok(Commands { _matrix: matrix }) |
| 305 | } |
304 | } |
| 306 | } |
305 | } |
src/lib.rs
+2 −2
| @@ -137,10 +137,10 @@ impl BarItemCallback for Servers { |
| 137 | } |
137 | } |
| 138 | |
138 | |
| 139 | impl WeechatPlugin for Matrix { |
139 | impl WeechatPlugin for Matrix { |
| 140 | fn init(weechat: &Weechat, _args: ArgsWeechat) -> Result<Self, ()> { |
140 | fn init(_: &Weechat, _args: ArgsWeechat) -> Result<Self, ()> { |
| 141 | let servers = Servers::new(); |
141 | let servers = Servers::new(); |
| 142 | let config = ConfigHandle::new(&servers); |
142 | let config = ConfigHandle::new(&servers); |
| 143 | let commands = Commands::hook_all(weechat, &servers, &config)?; |
143 | let commands = Commands::hook_all(&servers, &config)?; |
| 144 | |
144 | |
| 145 | // TODO move the bar creation into a separate file. |
145 | // TODO move the bar creation into a separate file. |
| 146 | let status_bar = |
146 | let status_bar = |