Move ChatMsg trait to chat2

This commit is contained in:
Joscha 2023-04-17 10:07:56 +02:00
parent 6f0088e194
commit e2b75d2f52
2 changed files with 11 additions and 3 deletions

View file

@ -26,7 +26,7 @@ use crate::macros::{logging_unwrap, ok_or_return, some_or_return};
use crate::util::InfallibleExt; use crate::util::InfallibleExt;
use crate::vault::Vault; use crate::vault::Vault;
pub use self::chat::ChatMsg; pub use self::chat2::ChatMsg;
use self::chat2::ChatState; use self::chat2::ChatState;
use self::input::{key, InputEvent, KeyBindingsList}; use self::input::{key, InputEvent, KeyBindingsList};
use self::rooms::Rooms; use self::rooms::Rooms;

View file

@ -8,8 +8,9 @@ use std::io;
use std::sync::Arc; use std::sync::Arc;
use parking_lot::FairMutex; use parking_lot::FairMutex;
use time::OffsetDateTime;
use toss::widgets::{BoxedAsync, EditorState}; use toss::widgets::{BoxedAsync, EditorState};
use toss::{Terminal, WidgetExt}; use toss::{Styled, Terminal, WidgetExt};
use crate::store::{Msg, MsgStore}; use crate::store::{Msg, MsgStore};
@ -17,7 +18,14 @@ use self::cursor::Cursor;
use self::tree::TreeViewState; use self::tree::TreeViewState;
use super::input::{InputEvent, KeyBindingsList}; 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 { pub enum Mode {
Tree, Tree,