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
use super::*;
#[derive(Debug, PartialEq, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ClearMsg {
pub tags: Tags,
pub channel: String,
pub message: Option<String>,
}
impl ClearMsg {
pub fn channel(&self) -> &str {
&self.channel
}
pub fn message(&self) -> Option<&str> {
self.message.as_ref().map(String::as_str)
}
}
impl ClearMsg {
pub fn login(&self) -> Option<&str> {
self.get("login")
}
pub fn target_msg_id(&self) -> Option<&str> {
self.get("target-msg-id")
}
}
impl Tag for ClearMsg {
fn get(&self, key: &str) -> Option<&str> {
self.tags.get(key).map(AsRef::as_ref)
}
}