diff options
Diffstat (limited to 'mumd/src/state.rs')
| -rw-r--r-- | mumd/src/state.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mumd/src/state.rs b/mumd/src/state.rs index 6e0d908..1ef8467 100644 --- a/mumd/src/state.rs +++ b/mumd/src/state.rs @@ -35,6 +35,17 @@ impl Server { } } + pub fn parse_channel_remove(&mut self, msg: Box<msgs::ChannelRemove>) { + if !msg.has_channel_id() { + warn!("Can't parse channel remove without channel id"); + return; + } + match self.channels.entry(msg.get_channel_id()) { + Entry::Vacant(_) => { warn!("Attempted to remove channel that doesn't exist"); } + Entry::Occupied(e) => { e.remove(); } + } + } + pub fn parse_user_state(&mut self, msg: Box<msgs::UserState>) { if !msg.has_session() { warn!("Can't parse user state without session"); |
