From 8e35c18e2aac958837b2c8fcb782950f86e5f214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 23 Oct 2020 01:50:20 +0200 Subject: add first notification --- mumd/src/state.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mumd/src/state.rs') diff --git a/mumd/src/state.rs b/mumd/src/state.rs index 44d8b21..6180654 100644 --- a/mumd/src/state.rs +++ b/mumd/src/state.rs @@ -228,6 +228,21 @@ impl State { let user = self.server_mut().unwrap().users_mut().get_mut(&sess).unwrap(); let diff = mumlib::state::UserDiff::from(msg); user.apply_user_diff(&diff); + let user = self.server().unwrap().users().get(&sess).unwrap(); + + // send notification + 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(); + } else { + warn!("{} moved to invalid channel {}", &user.name(), channel_id); + } + } + Some(diff) } } -- cgit v1.2.1