diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2020-10-13 00:10:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-13 00:10:36 +0200 |
| commit | e13ef720a93f9a03948efd7b605fdd2d4df20745 (patch) | |
| tree | 68a19b54519252d20369df284f7e94e663346da7 /mumd/src/state.rs | |
| parent | 7a7499aeaa45a33aed4b3bfd339c950fa21e1a08 (diff) | |
| download | mum-e13ef720a93f9a03948efd7b605fdd2d4df20745.tar.gz | |
parse channel remove (#3)
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"); |
