diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2020-10-23 02:33:35 +0200 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2020-10-23 02:33:35 +0200 |
| commit | f12b127c83da51cac99dbde1db091760ef8fe67c (patch) | |
| tree | 0eaa36ce98ce4f2a166885b21c78156037a8d70a | |
| parent | 867a59cdabb864007166bcf3075eddc3210a76e0 (diff) | |
| download | mum-f12b127c83da51cac99dbde1db091760ef8fe67c.tar.gz | |
send notif when someone connects
| -rw-r--r-- | mumd/src/state.rs | 19 |
1 files changed, 18 insertions, 1 deletions
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); } |
