aboutsummaryrefslogtreecommitdiffstats
path: root/mumlib/src
diff options
context:
space:
mode:
authorEskil Queseth <eskilq@kth.se>2020-11-05 00:44:04 +0100
committerEskil Queseth <eskilq@kth.se>2020-11-05 00:44:04 +0100
commit22579ced3d1d847a14683fe3b47fa2076df01751 (patch)
tree507d5c8ba721fb31cd58c207be8c0d66e12595c6 /mumlib/src
parent4dd73f7b837572211b71483d62bbdfb1227d2aee (diff)
downloadmum-22579ced3d1d847a14683fe3b47fa2076df01751.tar.gz
add mute feature
Diffstat (limited to 'mumlib/src')
-rw-r--r--mumlib/src/command.rs6
-rw-r--r--mumlib/src/state.rs12
2 files changed, 14 insertions, 4 deletions
diff --git a/mumlib/src/command.rs b/mumlib/src/command.rs
index 28b4d79..675fb7d 100644
--- a/mumlib/src/command.rs
+++ b/mumlib/src/command.rs
@@ -20,13 +20,13 @@ pub enum Command {
},
ServerDisconnect,
Status,
- DeafenSelf,
- MuteSelf,
- MuteOther(String),
ServerStatus {
host: String,
port: u16,
},
+ DeafenSelf(Option<bool>),
+ MuteSelf(Option<bool>),
+ MuteOther(String, Option<bool>),
}
#[derive(Debug, Deserialize, Serialize)]
diff --git a/mumlib/src/state.rs b/mumlib/src/state.rs
index b6b4039..0540f14 100644
--- a/mumlib/src/state.rs
+++ b/mumlib/src/state.rs
@@ -130,9 +130,19 @@ pub struct User {
pub deaf: bool, // by admin
}
+macro_rules! true_to_str {
+ ($condition:expr, $res:expr) => {if $condition { $res } else { "" }};
+}
+
impl Display for User {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- write!(f, "{}", self.name)
+ write!(f, "{} {}{}{}{}{}",
+ self.name,
+ true_to_str!(self.suppress, "s"),
+ true_to_str!(self.self_mute, "M"),
+ true_to_str!(self.self_deaf, "D"),
+ true_to_str!(self.mute, "m"),
+ true_to_str!(self.deaf, "d"))
}
}