From f22d3847a23484122fad83b22d7ca48316c9d7cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 7 Jun 2021 17:17:41 +0200 Subject: additional events --- mumlib/src/command.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'mumlib/src/command.rs') diff --git a/mumlib/src/command.rs b/mumlib/src/command.rs index 402d6b0..818fd70 100644 --- a/mumlib/src/command.rs +++ b/mumlib/src/command.rs @@ -20,8 +20,15 @@ impl fmt::Display for MumbleEvent { pub enum MumbleEventKind { UserConnected(String, Option), UserDisconnected(String, Option), + /// This logic is kinda weird so we only store the rendered message. + UserMuteStateChanged(String), + TextMessageReceived(String), + UserJoinedChannel(String, String), + UserLeftChannel(String, String), } +//TODO These strings are (mostly) duplicated with their respective notifications. +// The only difference is that the text message event doesn't contain the text message. impl fmt::Display for MumbleEventKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { @@ -31,6 +38,19 @@ impl fmt::Display for MumbleEventKind { MumbleEventKind::UserDisconnected(user, channel) => { write!(f, "{} disconnected from {}", user, channel.as_deref().unwrap_or("unknown channel")) } + MumbleEventKind::UserMuteStateChanged(message) => { + write!(f, "{}", message) + } + MumbleEventKind::TextMessageReceived(user) => { + write!(f, "{} sent a text message", user) + } + MumbleEventKind::UserJoinedChannel(name, from) => { + write!(f, "{} moved to your channel from {}", name, from) + } + MumbleEventKind::UserLeftChannel(name, to) => { + write!(f, "{} moved to {}", name, to) + } + } } } -- cgit v1.2.1