aboutsummaryrefslogtreecommitdiffstats
path: root/mumd/src/state.rs
diff options
context:
space:
mode:
authorEskil Queseth <eskilq@kth.se>2020-11-12 22:56:27 +0100
committerEskil Queseth <eskilq@kth.se>2020-11-12 22:56:27 +0100
commit7d55907189a7e5210843efcb3e74f345d594a673 (patch)
tree6b3eee6a578e6a4c9fa45dff2c1d19508a735535 /mumd/src/state.rs
parent1b3bcebc895bfa4b6f65697fafc31d482c74b2de (diff)
downloadmum-7d55907189a7e5210843efcb3e74f345d594a673.tar.gz
clean up bad code
Diffstat (limited to 'mumd/src/state.rs')
-rw-r--r--mumd/src/state.rs31
1 files changed, 19 insertions, 12 deletions
diff --git a/mumd/src/state.rs b/mumd/src/state.rs
index a767d30..0395b4f 100644
--- a/mumd/src/state.rs
+++ b/mumd/src/state.rs
@@ -431,6 +431,8 @@ impl State {
None
};
+ debug!("{:?} {:?} {:?}", mute, deaf, msg);
+
let diff = UserDiff::from(msg);
user.apply_user_diff(&diff);
let user = self.server().unwrap().users().get(&session).unwrap();
@@ -449,31 +451,36 @@ impl State {
}
}
+ let notify_desc = match (mute, deaf) {
+ (Some(true), Some(true)) => Some(format!("{} muted and deafend themselves", &user.name())),
+ (Some(false), Some(false)) => Some(format!("{} unmuted and undeafend themselves", &user.name())),
+ (None, Some(true)) => Some(format!("{} deafend themselves", &user.name())),
+ (None, Some(false)) => Some(format!("{} undeafend themselves", &user.name())),
+ (Some(true), None) => Some(format!("{} muted themselves", &user.name())),
+ (Some(false), None) => Some(format!("{} unmuted themselves", &user.name())),
+ (Some(true), Some(false)) => Some(format!("{} muted and undeafened themselves", &user.name())),
+ (Some(false), Some(true)) => Some(format!("{} unmuted and deafened themselves", &user.name())),
+ (None, None) => None,
+ };
// send notification if a user muted/unmuted
//TODO our channel only
- let notif_desc = if let Some(deaf) = deaf {
+ /*let notif_desc = if let Some(deaf) = deaf {
if deaf {
Some(format!("{} muted and deafend themselves", &user.name()))
- } else if !deaf {
- Some(format!("{} unmuted and undeafend themselves", &user.name()))
} else {
- warn!("Invalid user state received");
- None
+ Some(format!("{} unmuted and undeafend themselves", &user.name()))
}
} else if let Some(mute) = mute {
if mute {
Some(format!("{} muted themselves", &user.name()))
- } else if !mute {
- Some(format!("{} unmuted themselves", &user.name()))
} else {
- warn!("Invalid user state received");
- None
+ Some(format!("{} unmuted themselves", &user.name()))
}
} else {
None
- };
- if let Some(notif_desc) = notif_desc {
- notify::send(notif_desc);
+ };*/
+ if let Some(notify_desc) = notify_desc {
+ notify::send(notify_desc);
}
diff