aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/event.rs
blob: 26e3f867565cfe0220e866925fcadbd1cae8dc2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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, nick: 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,
}