use actix::{Addr, Message};
use anyhow::Result;
use tracing::Span;
use crate::{channel::Channel, client::Client, connection::InitiatedConnection};
#[derive(Message, Clone)]
#[rtype(message = "()")]
pub struct UserConnected {
pub handle: Addr<Client>,
pub connection: InitiatedConnection,
pub span: Span,
}
#[derive(Message, Clone)]
#[rtype(message = "()")]
pub struct ServerDisconnect {
pub client: Addr<Client>,
pub message: Option<String>,
pub span: Span,
}
#[derive(Message, Clone)]
#[rtype(result = "()")]
pub struct UserNickChange {
pub client: Addr<Client>,
pub connection: InitiatedConnection,
pub new_nick: String,
pub span: Span,
}
#[derive(Message, Clone)]
#[rtype(result = "super::server::response::ChannelList")]
pub struct ChannelList {
pub span: Span,
}
#[derive(Message)]
#[rtype(result = "Result<Addr<Channel>>")]
pub struct ChannelJoin {
pub channel_name: String,
pub client: Addr<Client>,
pub connection: InitiatedConnection,
pub span: Span,
}
#[derive(Message)]
#[rtype(result = "()")]
pub struct ChannelPart {
pub client: Addr<Client>,
pub message: Option<String>,
pub span: Span,
}
#[derive(Message)]
#[rtype(result = "super::channel::response::ChannelNamesList")]
pub struct ChannelMemberList {
pub span: Span,
}
#[derive(Message)]
#[rtype(result = "super::channel::response::ChannelTopic")]
pub struct ChannelFetchTopic {
pub span: Span,
}
#[derive(Message)]
#[rtype(result = "()")]
pub struct ChannelKickUser {
pub span: Span,
pub client: Addr<Client>,
pub user: String,
pub reason: Option<String>,
}
#[derive(Message)]
#[rtype(result = "super::server::response::Motd")]
pub struct ServerFetchMotd {
pub span: Span,
}
#[derive(Message)]
#[rtype(result = "()")]
pub struct UserKickedFromChannel {
pub channel: String,
pub span: Span,
}
#[derive(Message)]
#[rtype(result = "()")]
pub struct ChannelUpdateTopic {
pub topic: String,
pub client: Addr<Client>,
pub span: Span,
}
#[derive(Message, Clone)]
#[rtype(result = "()")]
pub struct Broadcast {
pub message: irc_proto::Message,
pub span: Span,
}
#[derive(Message)]
#[rtype(result = "crate::connection::InitiatedConnection")]
pub struct FetchClientDetails {
pub span: Span,
}
#[derive(Message)]
#[rtype(result = "()")]
pub struct ChannelMessage {
pub client: Addr<Client>,
pub message: String,
pub span: Span,
}
#[derive(Message)]
#[rtype(result = "super::channel::response::ChannelInviteResult")]
pub struct ChannelInvite {
pub nick: String,
pub client: Addr<Client>,
pub span: Span,
}
#[derive(Message)]
#[rtype(result = "Option<Addr<Client>>")]
pub struct FetchClientByNick {
pub nick: String,
}