use net_backend_protocol::chat::{ChatMessage, RoomKind};
use net_backend_protocol::{MessageId, RoomId, UserId};
use crate::hooks::Event;
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct BeforeChatJoin {
pub room: RoomId,
pub kind: RoomKind,
pub key: Option<String>,
pub user_id: UserId,
}
impl Event for BeforeChatJoin {
const NAME: &'static str = "chat.before_join";
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct BeforeChatSend {
pub room: RoomId,
pub kind: RoomKind,
pub sender: UserId,
pub text: String,
pub nonce: Option<String>,
}
impl Event for BeforeChatSend {
const NAME: &'static str = "chat.before_send";
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct AfterChatSend {
pub message: ChatMessage,
pub kind: RoomKind,
}
impl Event for AfterChatSend {
const NAME: &'static str = "chat.after_send";
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct BeforeDirectOpen {
pub user_id: UserId,
pub peer: UserId,
}
impl Event for BeforeDirectOpen {
const NAME: &'static str = "chat.before_direct_open";
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct AfterChatDelete {
pub room: RoomId,
pub message: MessageId,
pub sender: UserId,
pub deleted_by: Option<UserId>,
}
impl Event for AfterChatDelete {
const NAME: &'static str = "chat.after_delete";
}