aboutsummaryrefslogtreecommitdiff
path: root/src/primitive/message.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/primitive/message.rs')
-rw-r--r--src/primitive/message.rs43
1 files changed, 13 insertions, 30 deletions
diff --git a/src/primitive/message.rs b/src/primitive/message.rs
index 3d6f560..bac3899 100644
--- a/src/primitive/message.rs
+++ b/src/primitive/message.rs
@@ -6,6 +6,7 @@ use crate::{deserialize::*, serialize::*};
use crate::primitive::{BufferInfo, MsgId};
use super::{Variant, VariantList};
+use crate::serialize::UserType;
/// The Message struct represents a Message as received in IRC
///
@@ -158,30 +159,10 @@ impl Deserialize for Message {
}
}
-// #[repr(i32)]
-// #[derive(Copy, Clone, Debug, std::cmp::PartialEq, FromPrimitive, ToPrimitive)]
-// pub enum MessageType {
-// None = 0x00000000,
-// Plain = 0x00000001,
-// Notice = 0x00000002,
-// Action = 0x00000004,
-// Nick = 0x00000008,
-// Mode = 0x00000010,
-// Join = 0x00000020,
-// Part = 0x00000040,
-// Quit = 0x00000080,
-// Kick = 0x00000100,
-// Kill = 0x00000200,
-// Server = 0x00000400,
-// Info = 0x00000800,
-// Error = 0x00001000,
-// DayChange = 0x00002000,
-// Topic = 0x00004000,
-// NetsplitJoin = 0x00008000,
-// NetsplitQuit = 0x00010000,
-// Invite = 0x00020000,
-// Markerline = 0x00040000,
-// }
+impl UserType for Message {
+ const NAME: &str = "Message";
+}
+
use bitflags::bitflags;
bitflags! {
@@ -276,12 +257,14 @@ mod tests {
assert_eq!(
message.serialize().unwrap(),
[
- 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 95, 244, 79, 69, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1,
- 0, 2, 0, 0, 0, 0, 0, 0, 0, 5, 35, 116, 101, 115, 116, 0, 0, 0, 4, 116, 101, 115, 116, 0, 0,
- 0, 6, 98, 108, 97, 98, 108, 97, 0, 0, 0, 9, 116, 101, 115, 116, 32, 117, 115, 101, 114, 0, 0,
- 0, 28, 104, 116, 116, 112, 115, 58, 47, 47, 106, 102, 107, 97, 108, 115, 100, 107, 106, 102,
- 106, 46, 99, 111, 109, 47, 107, 106, 107, 106, 0, 0, 0, 22, 116, 104, 105, 115, 32, 105, 115,
- 32, 97, 32, 116, 101, 115, 116, 32, 109, 101, 115, 115, 97, 103, 101
+ 0, 0, 0, 5, 77, 115, 103, 73, 100, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 95, 244, 79, 69, 0, 0,
+ 0, 1, 0, 0, 0, 0, 10, 66, 117, 102, 102, 101, 114, 73, 110, 102, 111, 0, 0, 0, 8, 66, 117,
+ 102, 102, 101, 114, 73, 100, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 5, 35, 116,
+ 101, 115, 116, 0, 0, 0, 4, 116, 101, 115, 116, 0, 0, 0, 6, 98, 108, 97, 98, 108, 97, 0, 0, 0,
+ 9, 116, 101, 115, 116, 32, 117, 115, 101, 114, 0, 0, 0, 28, 104, 116, 116, 112, 115, 58, 47,
+ 47, 106, 102, 107, 97, 108, 115, 100, 107, 106, 102, 106, 46, 99, 111, 109, 47, 107, 106,
+ 107, 106, 0, 0, 0, 22, 116, 104, 105, 115, 32, 105, 115, 32, 97, 32, 116, 101, 115, 116, 32,
+ 109, 101, 115, 115, 97, 103, 101
]
)
}