diff --git a/src/ui.rs b/src/ui.rs index eae4f36..654c819 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -26,7 +26,7 @@ use crate::macros::{logging_unwrap, ok_or_return, some_or_return}; use crate::util::InfallibleExt; use crate::vault::Vault; -pub use self::chat::ChatMsg; +pub use self::chat2::ChatMsg; use self::chat2::ChatState; use self::input::{key, InputEvent, KeyBindingsList}; use self::rooms::Rooms; diff --git a/src/ui/chat2.rs b/src/ui/chat2.rs index 7567de4..24b0185 100644 --- a/src/ui/chat2.rs +++ b/src/ui/chat2.rs @@ -8,8 +8,9 @@ use std::io; use std::sync::Arc; use parking_lot::FairMutex; +use time::OffsetDateTime; use toss::widgets::{BoxedAsync, EditorState}; -use toss::{Terminal, WidgetExt}; +use toss::{Styled, Terminal, WidgetExt}; use crate::store::{Msg, MsgStore}; @@ -17,7 +18,14 @@ use self::cursor::Cursor; use self::tree::TreeViewState; use super::input::{InputEvent, KeyBindingsList}; -use super::{ChatMsg, UiError}; +use super::UiError; + +pub trait ChatMsg { + fn time(&self) -> OffsetDateTime; + fn styled(&self) -> (Styled, Styled); + fn edit(nick: &str, content: &str) -> (Styled, Styled); + fn pseudo(nick: &str, content: &str) -> (Styled, Styled); +} pub enum Mode { Tree,