aboutsummaryrefslogtreecommitdiff
path: root/src/events.rs
diff options
context:
space:
mode:
authorTill Hoeppner2014-10-21 15:33:17 +0200
committerTill Hoeppner2014-10-21 16:15:10 +0200
commitfc27f8cee888acf70683badca9edadb45544822c (patch)
treef39314f857e92a1e5a19f9675205750adf8919f0 /src/events.rs
parentce640c2c25b0e16c567553c5774d633c13cbf0ee (diff)
downloadirsc-fc27f8cee888acf70683badca9edadb45544822c.tar.gz
irsc-fc27f8cee888acf70683badca9edadb45544822c.tar.xz
irsc-fc27f8cee888acf70683badca9edadb45544822c.zip
Initial commit.
Diffstat (limited to 'src/events.rs')
-rw-r--r--src/events.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/events.rs b/src/events.rs
new file mode 100644
index 0000000..8c474d7
--- /dev/null
+++ b/src/events.rs
@@ -0,0 +1,22 @@
+use ident::Ident;
+
+macro_rules! string_record(
+ ($name: ident, $( $fields: ident ),*) => (
+ #[deriving(Show, Clone)]
+ pub struct $name {
+ $(pub $fields: String),*
+ }
+ )
+)
+
+string_record!(Welcome, source, target, msg)
+string_record!(YourHost, source, target, msg)
+string_record!(Created, source, target, msg)
+
+#[deriving(Show, Clone)]
+pub enum Event {
+ RplWelcome(Box<Welcome>),
+ RplYourHost(Box<YourHost>),
+ RplCreated(Box<Created>),
+ PrivMsg(Ident, String, String)
+}