aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/event.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/event.rs')
-rw-r--r--src/client/event.rs50
1 files changed, 50 insertions, 0 deletions
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<String>,
+ },
+
+ /// Someone quit the server
+ Quit {
+ nick: String,
+ reason: Option<String>,
+ },
+
+ /// 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<String>,
+ },
+
+ /// 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,
+}