From ffb9c05de1c755dbddd8b67cca1d6023b213115f Mon Sep 17 00:00:00 2001 From: lancebord Date: Fri, 6 Mar 2026 18:09:52 -0500 Subject: initial commit --- src/client/event.rs | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/client/event.rs (limited to 'src/client/event.rs') diff --git a/src/client/event.rs b/src/client/event.rs new file mode 100644 index 0000000..d34908d --- /dev/null +++ b/src/client/event.rs @@ -0,0 +1,50 @@ +/// Events produced by the IRC client and surfaced to your application. +/// Match on these in your main loop to drive UI, bot logic, etc. +#[derive(Debug, Clone)] +pub enum Event { + /// Successfully registered with the server (001 received) + Connected { server: String, nick: String }, + + /// A PRIVMSG or NOTICE in a channel or as a PM + Message { + from: String, + target: String, + text: String, + is_notice: bool, + }, + + /// We joined a channel + Joined { channel: String }, + + /// We or someone else left a channel + Parted { + channel: String, + nick: String, + reason: Option, + }, + + /// Someone quit the server + Quit { + nick: String, + reason: Option, + }, + + /// A nick change (could be ours) + NickChanged { old_nick: String, new_nick: String }, + + /// Channel topic was set or changed + Topic { channel: String, topic: String }, + + /// NAMES list entry (members of a channel) + Names { + channel: String, + members: Vec, + }, + + /// A raw message we didn't handle specifically + /// Useful for debugging or handling custom commands + Raw(crate::proto::message::IrcMessage), + + /// The connection was closed + Disconnected, +} -- cgit v1.2.3-59-g8ed1b