1 /** 
2  * Internal eventing definitions for use
3  * with `eventy`
4  */
5 module birchwood.client.events;
6 
7 import eventy : EventyEvent = Event;
8 import birchwood.protocol.messages : Message;
9 
10 /** 
11  * Event IDs
12  */
13 public final enum IRCEventType : ulong
14 {
15     /** 
16      * A generic IRC event
17      */
18     GENERIC_EVENT = 1,
19 
20     /** 
21      * A pong event
22      */
23     PONG_EVENT
24 }
25 
26 /** 
27  * Generic IRC event (non-pong)
28  */
29 public final class IRCEvent : EventyEvent
30 {   
31     private Message msg;
32 
33     this(Message msg)
34     {
35         super(IRCEventType.GENERIC_EVENT);
36 
37         this.msg = msg;
38     }
39 
40     public Message getMessage()
41     {
42         return msg;
43     }
44 
45     public override string toString()
46     {
47         return msg.toString();
48     }
49 }
50 
51 /* TODO: make PongEvent (id 2 buit-in) */
52 /** 
53  * Pong event
54  */
55 public final class PongEvent : EventyEvent
56 {
57     private string pingID;
58 
59     this(string pingID)
60     {
61         super(IRCEventType.PONG_EVENT);
62         this.pingID = pingID;
63     }
64 
65     public string getID()
66     {
67         return pingID;
68     }
69 }