aboutsummaryrefslogtreecommitdiffstats
path: root/mumlib
diff options
context:
space:
mode:
Diffstat (limited to 'mumlib')
-rw-r--r--mumlib/src/command.rs3
-rw-r--r--mumlib/src/state.rs21
2 files changed, 23 insertions, 1 deletions
diff --git a/mumlib/src/command.rs b/mumlib/src/command.rs
index 2fed4f1..675fb7d 100644
--- a/mumlib/src/command.rs
+++ b/mumlib/src/command.rs
@@ -24,6 +24,9 @@ pub enum Command {
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..3b1da56 100644
--- a/mumlib/src/state.rs
+++ b/mumlib/src/state.rs
@@ -130,9 +130,28 @@ 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")
+ )
}
}