diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2020-10-23 02:40:07 +0200 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2020-10-23 02:40:07 +0200 |
| commit | 83e144ef7ce0e922be14cd2ef2abc938ab971c65 (patch) | |
| tree | a157c9a4e6478f0b7c48a0fa9bf7c3976f86563e /mumd/src/state.rs | |
| parent | f12b127c83da51cac99dbde1db091760ef8fe67c (diff) | |
| download | mum-83e144ef7ce0e922be14cd2ef2abc938ab971c65.tar.gz | |
send notif when someone disconnects
Diffstat (limited to 'mumd/src/state.rs')
| -rw-r--r-- | mumd/src/state.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mumd/src/state.rs b/mumd/src/state.rs index 39221a3..85245a6 100644 --- a/mumd/src/state.rs +++ b/mumd/src/state.rs @@ -222,6 +222,7 @@ impl State { // this is someone else self.audio_mut().add_client(sess); + // send notification only if we've passed the connecting phase if *self.phase_receiver().borrow() == StatePhase::Connected { let channel_id = if msg.has_channel_id() { msg.get_channel_id() @@ -269,6 +270,14 @@ impl State { warn!("Tried to remove user state without session"); 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(); + } + self.audio().remove_client(msg.get_session()); self.server_mut().unwrap().users_mut().remove(&msg.get_session()); info!("User {} disconnected", msg.get_session()); |
