Show unknown messages in Server log
This commit is contained in:
parent
4a10e38cfc
commit
6ca03dcfc8
3 changed files with 11 additions and 1 deletions
|
@ -18,4 +18,7 @@ pub enum IrcMessage {
|
|||
nickname: String,
|
||||
message: String,
|
||||
},
|
||||
Other {
|
||||
message: String,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ impl Application for Cri {
|
|||
.on_privmsg(channel, &source_nickname, content);
|
||||
}
|
||||
|
||||
_ => (),
|
||||
_ => self.message_log.on_other(&message.to_string()),
|
||||
}
|
||||
}
|
||||
UiMessage::InputChanged(text) => self.input_value = text,
|
||||
|
|
|
@ -68,6 +68,12 @@ impl<'a> MessageLog {
|
|||
})
|
||||
}
|
||||
|
||||
pub(crate) fn on_other(&mut self, message: &str) {
|
||||
self.get_mut(None).push(IrcMessage::Other {
|
||||
message: message.trim().to_string(),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn view(&self, active_channel: &Option<String>) -> Container<'_, crate::UiMessage> {
|
||||
let lighter_grey = Color::new(0.93, 0.94, 0.95, 1.0);
|
||||
let dark_grey = Color::new(0.58, 0.65, 0.65, 1.0);
|
||||
|
@ -188,6 +194,7 @@ impl<'a> MessageLog {
|
|||
.into(),
|
||||
)
|
||||
}
|
||||
IrcMessage::Other { message } => Some(text(message).into()),
|
||||
}
|
||||
})
|
||||
.map(|element| element.into())
|
||||
|
|
Loading…
Reference in a new issue