diff options
Diffstat (limited to 'mumd')
| -rw-r--r-- | mumd/src/main.rs | 3 | ||||
| -rw-r--r-- | mumd/src/state.rs | 29 |
2 files changed, 10 insertions, 22 deletions
diff --git a/mumd/src/main.rs b/mumd/src/main.rs index 79e44a2..37ff0dd 100644 --- a/mumd/src/main.rs +++ b/mumd/src/main.rs @@ -1,6 +1,7 @@ mod audio; mod command; mod network; +mod notify; mod state; use crate::network::ConnectionInfo; @@ -22,7 +23,7 @@ use tokio::task::spawn_blocking; #[tokio::main] async fn main() { setup_logger(std::io::stderr(), true); - libnotify::init("mumd").unwrap(); + notify::init(); // Oneshot channel for setting UDP CryptState from control task // For simplicity we don't deal with re-syncing, real applications would have to. diff --git a/mumd/src/state.rs b/mumd/src/state.rs index ea0213c..ea081fc 100644 --- a/mumd/src/state.rs +++ b/mumd/src/state.rs @@ -4,6 +4,7 @@ pub mod user; use crate::audio::Audio; use crate::network::ConnectionInfo; +use crate::notify; use crate::state::server::Server; use log::*; @@ -239,12 +240,7 @@ impl State { 0 }; if let Some(channel) = self.server().unwrap().channels().get(&channel_id) { - libnotify::Notification::new("mumd", - Some(format!("{} connected and joined {}", - &msg.get_name(), - channel.name()).as_str()), - None) - .show().unwrap(); + notify::send(format!("{} connected and joined {}", &msg.get_name(), channel.name())); } } } @@ -273,12 +269,10 @@ impl State { //TODO our channel only if let Some(channel_id) = diff.channel_id { if let Some(channel) = self.server().unwrap().channels().get(&channel_id) { - libnotify::Notification::new("mumd", - Some(format!("{} moved to channel {}", - &user.name(), - channel.name()).as_str()), - None) - .show().unwrap(); + notify::send(format!( + "{} moved to channel {}", + &user.name(), + channel.name())); } else { warn!("{} moved to invalid channel {}", &user.name(), channel_id); } @@ -309,10 +303,7 @@ impl State { None }; if let Some(notif_desc) = notif_desc { - libnotify::Notification::new("mumd", - notif_desc.as_str(), - None) - .show().unwrap(); + notify::send(notif_desc); } diff @@ -324,11 +315,7 @@ impl State { return; } if let Some(user) = self.server().unwrap().users().get(&msg.get_session()) { - libnotify::Notification::new("mumd", - Some(format!("{} disconnected", - &user.name()).as_str()), - None) - .show().unwrap(); + notify::send(format!("{} disconnected", &user.name())); } self.audio().remove_client(msg.get_session()); |
