aboutsummaryrefslogtreecommitdiffstats
path: root/mumlib/src/state.rs
diff options
context:
space:
mode:
authorEskil Queseth <eskilq@kth.se>2020-10-17 01:19:45 +0200
committerEskil Queseth <eskilq@kth.se>2020-10-17 01:19:45 +0200
commit1974db9d719640f5cd5a8b51fa1b97f801f5a809 (patch)
tree47d1b1a92a836ef0f69e45a543b96c11451ab380 /mumlib/src/state.rs
parente2f5c15e17d0ddcde88830194410c387793c045f (diff)
downloadmum-1974db9d719640f5cd5a8b51fa1b97f801f5a809.tar.gz
change connecting with channel name instead of id
Diffstat (limited to 'mumlib/src/state.rs')
-rw-r--r--mumlib/src/state.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/mumlib/src/state.rs b/mumlib/src/state.rs
index f90634e..51fb492 100644
--- a/mumlib/src/state.rs
+++ b/mumlib/src/state.rs
@@ -128,6 +128,13 @@ impl Channel {
pub fn name(&self) -> &str {
&self.name
}
+
+ pub fn path(&self, channels: &HashMap<u32, Channel>) -> String {
+ match &self.parent {
+ Some(t) => format!("{}/{}", channels.get(t).unwrap().path(channels), self.name),
+ None => self.name.clone(),
+ }
+ }
}
#[derive(Clone, Debug, Deserialize, Serialize)]