aboutsummaryrefslogtreecommitdiffstats
path: root/mumd/src/state/server.rs
diff options
context:
space:
mode:
Diffstat (limited to 'mumd/src/state/server.rs')
-rw-r--r--mumd/src/state/server.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/mumd/src/state/server.rs b/mumd/src/state/server.rs
index 869940a..4abde49 100644
--- a/mumd/src/state/server.rs
+++ b/mumd/src/state/server.rs
@@ -132,6 +132,15 @@ impl Server {
})
}
+ /// Returns the currenctly connected channel.
+ ///
+ /// Returns None if not connected.
+ pub fn current_channel(&self) -> Option<(u32, &Channel)> {
+ let channel_id = self.users().get(&self.session_id()?)?.channel();
+ let channel = self.channels().get(&channel_id)?;
+ Some((channel_id, channel))
+ }
+
pub fn host_mut(&mut self) -> &mut Option<String> {
&mut self.host
}