use crate::reply::roster::WsRow;
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct Channel {
pub name: String,
pub named_there: Option<String>,
}
impl Channel {
pub fn address(&self, row: &WsRow) -> Option<String> {
match &self.named_there {
None => Some(row.workspace.clone()),
Some(there) if *there == row.workspace => Some(self.name.clone()),
Some(_) => None,
}
}
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct Chunk {
pub channel: Channel,
pub stale: Option<String>,
pub growth: Option<String>,
pub walls: Vec<WsRow>,
}
impl Chunk {
pub fn of(channel: Channel) -> Self {
Self {
channel,
..Self::default()
}
}
}