From f12b127c83da51cac99dbde1db091760ef8fe67c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 23 Oct 2020 02:33:35 +0200 Subject: send notif when someone connects --- mumd/src/state.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/mumd/src/state.rs b/mumd/src/state.rs index 6180654..39221a3 100644 --- a/mumd/src/state.rs +++ b/mumd/src/state.rs @@ -221,6 +221,22 @@ impl State { } else { // this is someone else self.audio_mut().add_client(sess); + + if *self.phase_receiver().borrow() == StatePhase::Connected { + let channel_id = if msg.has_channel_id() { + msg.get_channel_id() + } else { + 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(); + } + } } self.server_mut().unwrap().users_mut().insert(sess, user::User::new(msg)); None @@ -237,7 +253,8 @@ impl State { Some(format!("{} moved to channel {}", &user.name(), channel.name()).as_str()), - None).show().unwrap(); + None) + .show().unwrap(); } else { warn!("{} moved to invalid channel {}", &user.name(), channel_id); } -- cgit v1.2.1