Commit 4fd4dd8340
Unsigned
Layout: unified · split
Cargo.lock +1 −3
| @@ -1269,6 +1269,7 @@ version = "0.1.0" | ||
| 1269 | 1269 | dependencies = [ |
| 1270 | 1270 | "async-trait", |
| 1271 | 1271 | "dashmap", |
| 1272 | "futures", | |
| 1272 | 1273 | "futures-timer", |
| 1273 | 1274 | "http", |
| 1274 | 1275 | "matrix-sdk-base", |
| @@ -2883,7 +2884,6 @@ dependencies = [ | ||
| 2883 | 2884 | [[package]] |
| 2884 | 2885 | name = "weechat" |
| 2885 | 2886 | version = "0.4.0" |
| 2886 | source = "git+https://github.com/poljar/rust-weechat#a418b770a4bfa70457792f9817bc966f61cb9be1" | |
| 2887 | 2887 | dependencies = [ |
| 2888 | 2888 | "async-task", |
| 2889 | 2889 | "async-trait", |
| @@ -2899,7 +2899,6 @@ dependencies = [ | ||
| 2899 | 2899 | [[package]] |
| 2900 | 2900 | name = "weechat-macro" |
| 2901 | 2901 | version = "0.4.0" |
| 2902 | source = "git+https://github.com/poljar/rust-weechat#a418b770a4bfa70457792f9817bc966f61cb9be1" | |
| 2903 | 2902 | dependencies = [ |
| 2904 | 2903 | "libc", |
| 2905 | 2904 | "proc-macro2", |
| @@ -2932,7 +2931,6 @@ dependencies = [ | ||
| 2932 | 2931 | [[package]] |
| 2933 | 2932 | name = "weechat-sys" |
| 2934 | 2933 | version = "0.4.0" |
| 2935 | source = "git+https://github.com/poljar/rust-weechat#a418b770a4bfa70457792f9817bc966f61cb9be1" | |
| 2936 | 2934 | dependencies = [ |
| 2937 | 2935 | "bindgen", |
| 2938 | 2936 | "libc", |
Cargo.toml +1 −1
| @@ -26,7 +26,7 @@ chrono = "0.4.19" | ||
| 26 | 26 | serde_json = "1.0.59" |
| 27 | 27 | |
| 28 | 28 | [dependencies.weechat] |
| 29 | git = "https://github.com/poljar/rust-weechat" | |
| 29 | path = "/home/poljar/werk/misc/rust-weechat/weechat" | |
| 30 | 30 | features = ["async", "config_macro"] |
| 31 | 31 | |
| 32 | 32 | [dependencies.matrix-sdk] |
src/commands/devices.rs +2 −2
| @@ -7,7 +7,7 @@ use matrix_sdk::identifiers::DeviceIdBox; | ||
| 7 | 7 | use weechat::{ |
| 8 | 8 | buffer::Buffer, |
| 9 | 9 | hooks::{Command, CommandCallback, CommandSettings}, |
| 10 | Args, Weechat, | |
| 10 | Args, Prefix, Weechat, | |
| 11 | 11 | }; |
| 12 | 12 | |
| 13 | 13 | use super::parse_and_run; |
| @@ -86,7 +86,7 @@ impl DevicesCommand { | ||
| 86 | 86 | } |
| 87 | 87 | _ => Weechat::print(&format!( |
| 88 | 88 | "{}Subcommand isn't implemented", |
| 89 | Weechat::prefix("error") | |
| 89 | Weechat::prefix(Prefix::Error) | |
| 90 | 90 | )), |
| 91 | 91 | } |
| 92 | 92 | } |
src/commands/matrix.rs +2 −2
| @@ -7,7 +7,7 @@ use url::Url; | ||
| 7 | 7 | use weechat::{ |
| 8 | 8 | buffer::Buffer, |
| 9 | 9 | hooks::{Command, CommandCallback, CommandSettings}, |
| 10 | Args, Weechat, | |
| 10 | Args, Prefix, Weechat, | |
| 11 | 11 | }; |
| 12 | 12 | |
| 13 | 13 | use super::parse_and_run; |
| @@ -174,7 +174,7 @@ Use /matrix [command] help to find out more.\n", | ||
| 174 | 174 | fn server_not_found(&self, server_name: &str) { |
| 175 | 175 | Weechat::print(&format!( |
| 176 | 176 | "{}{}: Server \"{}{}{}\" not found.", |
| 177 | Weechat::prefix("error"), | |
| 177 | Weechat::prefix(Prefix::Error), | |
| 178 | 178 | PLUGIN_NAME, |
| 179 | 179 | Weechat::color("chat_server"), |
| 180 | 180 | server_name, |
src/commands/mod.rs +2 −2
| @@ -6,17 +6,17 @@ use weechat::{ | ||
| 6 | 6 | |
| 7 | 7 | use crate::{config::ConfigHandle, Servers}; |
| 8 | 8 | |
| 9 | mod buffer_clear; | |
| 9 | 10 | mod devices; |
| 10 | 11 | mod keys; |
| 11 | 12 | mod matrix; |
| 12 | 13 | mod page_up; |
| 13 | mod buffer_clear; | |
| 14 | 14 | |
| 15 | use buffer_clear::BufferClearCommand; | |
| 15 | 16 | use devices::DevicesCommand; |
| 16 | 17 | use keys::KeysCommand; |
| 17 | 18 | use matrix::MatrixCommand; |
| 18 | 19 | use page_up::PageUpCommand; |
| 19 | use buffer_clear::BufferClearCommand; | |
| 20 | 20 | |
| 21 | 21 | pub struct Commands { |
| 22 | 22 | _matrix: Command, |
src/render.rs +12 −10
| @@ -20,7 +20,7 @@ use matrix_sdk::{ | ||
| 20 | 20 | uuid::Uuid, |
| 21 | 21 | }; |
| 22 | 22 | |
| 23 | use weechat::Weechat; | |
| 23 | use weechat::{Prefix, Weechat}; | |
| 24 | 24 | |
| 25 | 25 | use crate::room::WeechatRoomMember; |
| 26 | 26 | |
| @@ -173,7 +173,7 @@ impl Render for EmoteMessageEventContent { | ||
| 173 | 173 | type RenderContext = WeechatRoomMember; |
| 174 | 174 | |
| 175 | 175 | fn prefix(&self, _: &WeechatRoomMember) -> String { |
| 176 | Weechat::prefix("action").to_owned() | |
| 176 | Weechat::prefix(Prefix::Action).to_owned() | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | fn render(&self, sender: &Self::RenderContext) -> RenderedContent { |
| @@ -195,7 +195,7 @@ impl Render for LocationMessageEventContent { | ||
| 195 | 195 | type RenderContext = WeechatRoomMember; |
| 196 | 196 | |
| 197 | 197 | fn prefix(&self, _: &WeechatRoomMember) -> String { |
| 198 | Weechat::prefix("action").to_owned() | |
| 198 | Weechat::prefix(Prefix::Action).to_owned() | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | fn render(&self, sender: &Self::RenderContext) -> RenderedContent { |
| @@ -223,7 +223,7 @@ impl Render for NoticeMessageEventContent { | ||
| 223 | 223 | type RenderContext = WeechatRoomMember; |
| 224 | 224 | |
| 225 | 225 | fn prefix(&self, _: &WeechatRoomMember) -> String { |
| 226 | Weechat::prefix("action").to_owned() | |
| 226 | Weechat::prefix(Prefix::Action).to_owned() | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | fn render(&self, sender: &Self::RenderContext) -> RenderedContent { |
| @@ -233,7 +233,7 @@ impl Render for NoticeMessageEventContent { | ||
| 233 | 233 | {color_delim}({color_reset}{}{color_delim}){color_reset}: {}", |
| 234 | 234 | sender.nick.borrow(), |
| 235 | 235 | self.body, |
| 236 | prefix = Weechat::prefix("network"), | |
| 236 | prefix = Weechat::prefix(Prefix::Network), | |
| 237 | 237 | color_notice = Weechat::color("irc.color.notice"), |
| 238 | 238 | color_delim = Weechat::color("chat_delimiters"), |
| 239 | 239 | color_reset = Weechat::color("reset"), |
| @@ -253,7 +253,7 @@ impl Render for ServerNoticeMessageEventContent { | ||
| 253 | 253 | type RenderContext = WeechatRoomMember; |
| 254 | 254 | |
| 255 | 255 | fn prefix(&self, _: &WeechatRoomMember) -> String { |
| 256 | Weechat::prefix("action").to_owned() | |
| 256 | Weechat::prefix(Prefix::Action).to_owned() | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | fn render(&self, sender: &Self::RenderContext) -> RenderedContent { |
| @@ -262,7 +262,7 @@ impl Render for ServerNoticeMessageEventContent { | ||
| 262 | 262 | {color_delim}({color_reset}{}{color_delim}){color_reset}: {}", |
| 263 | 263 | sender.nick.borrow(), |
| 264 | 264 | self.body, |
| 265 | prefix = Weechat::prefix("network"), | |
| 265 | prefix = Weechat::prefix(Prefix::Network), | |
| 266 | 266 | color_notice = Weechat::color("irc.color.notice"), |
| 267 | 267 | color_delim = Weechat::color("chat_delimiters"), |
| 268 | 268 | color_reset = Weechat::color("reset"), |
| @@ -472,9 +472,11 @@ pub fn render_membership( | ||
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | let (prefix, color_action) = match change_op { |
| 475 | Joined => ("join", "green"), | |
| 476 | Banned | ProfileChanged { .. } | Invited => ("network", "magenta"), | |
| 477 | _ => ("quit", "red"), | |
| 475 | Joined => (Prefix::Join, "green"), | |
| 476 | Banned | ProfileChanged { .. } | Invited => { | |
| 477 | (Prefix::Network, "magenta") | |
| 478 | } | |
| 479 | _ => (Prefix::Quit, "red"), | |
| 478 | 480 | }; |
| 479 | 481 | |
| 480 | 482 | let color_action = Weechat::color(color_action); |
src/server.rs +3 −3
| @@ -75,7 +75,7 @@ use matrix_sdk::{ | ||
| 75 | 75 | use weechat::{ |
| 76 | 76 | buffer::{BufferBuilder, BufferHandle}, |
| 77 | 77 | config::{BooleanOptionSettings, ConfigSection, StringOptionSettings}, |
| 78 | Weechat, | |
| 78 | Prefix, Weechat, | |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | 81 | use crate::{ |
| @@ -794,12 +794,12 @@ impl InnerServer { | ||
| 794 | 794 | |
| 795 | 795 | /// Print an network message to the server buffer. |
| 796 | 796 | pub fn print_network(&self, message: &str) { |
| 797 | self.print_with_prefix(Weechat::prefix("network"), message); | |
| 797 | self.print_with_prefix(&Weechat::prefix(Prefix::Network), message); | |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | /// Print an error message to the server buffer. |
| 801 | 801 | pub fn print_error(&self, message: &str) { |
| 802 | self.print_with_prefix(Weechat::prefix("error"), message); | |
| 802 | self.print_with_prefix(&Weechat::prefix(Prefix::Error), message); | |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | /// Is the server connected. |