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
/// When a user gains or loses moderator (operator) status in a channel.
#[derive(Debug, PartialEq, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Mode {
    /// The channel this event happened on
    pub channel: String,
    /// Whether they lost or gained the status
    pub status: ModeStatus,
    /// Which user was effected by this
    pub user: String,
}

impl Mode {
    /// The channel this event happened on
    pub fn channel(&self) -> &str {
        &self.channel
    }
    /// Whether they lost or gained the status
    pub fn status(&self) -> ModeStatus {
        self.status
    }
    /// Which user was effected by this
    pub fn user(&self) -> &str {
        &self.user
    }
}

/// Status of gaining or losing moderator (operator) status
#[derive(Debug, Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum ModeStatus {
    /// Moderator status gained
    Gained,
    /// Moderator status lost
    Lost,
}