From 61d578ad3e6fd1f59cb46436b45374c8fe3936c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 23 Oct 2020 03:31:59 +0200 Subject: minor cleanup --- mumd/src/state.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'mumd/src/state.rs') diff --git a/mumd/src/state.rs b/mumd/src/state.rs index b27d401..3aff353 100644 --- a/mumd/src/state.rs +++ b/mumd/src/state.rs @@ -214,9 +214,9 @@ impl State { // check if this is initial state if !self.server().unwrap().users().contains_key(&session) { self.parse_initial_user_state(session, msg); - None + return None; } else { - Some(self.parse_updated_user_state(session, msg)) + return Some(self.parse_updated_user_state(session, msg)); } } @@ -256,14 +256,15 @@ impl State { user.apply_user_diff(&diff); let user = self.server().unwrap().users().get(&session).unwrap(); - // send notification + // send notification if the user moved to or from any channel + //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) + Some(format!("{} moved to channel {}", + &user.name(), + channel.name()).as_str()), + None) .show().unwrap(); } else { warn!("{} moved to invalid channel {}", &user.name(), channel_id); -- cgit v1.2.1