-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvents.cs
More file actions
128 lines (107 loc) · 2.84 KB
/
Events.cs
File metadata and controls
128 lines (107 loc) · 2.84 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
using System;
using System.Collections;
namespace lilySharp
{
/// <summary>
/// Parses %notify events into easily accessable fields
/// </summary>
public class NotifyEvent
{
private String command,
eventStr,
valueStr;
private ILilyObject source;
private ILilyObject[] recipients;
private DateTime time;
private bool notify,
bell,
stamp,
empty;
/// <summary>
/// Allows access to the command ID of the event
/// TODO: Make this an integer
/// </summary>
/// <value>Allows access to the command ID of the event</value>
public String Command
{
get { return command; }
}
/// <summary>
/// Allows access to the source of the event
/// </summary>
/// <value>Allows access to the source of the event</value>
public ILilyObject Source
{
get { return source; }
}
/// <summary>
/// Allows access to the type of the event
/// </summary>
/// <value>Allows access to the type of the event</value>
public String Event
{
get { return eventStr;}
}
/// <summary>
/// Allows access to the value of the event
/// </summary>
/// <value>Allows access to the value of the event</value>
public String Value
{
get { return valueStr;}
}
/// <summary>
/// Allows access to the recipient list
/// </summary>
/// <value>Allows access to the recipient list</value>
public ILilyObject[] Recipients
{
get { return recipients; }
}
/// <summary>
/// Allows access to the timestamp of the event
/// </summary>
/// <value>Allows access to the recipient list</value>
public DateTime Time
{
get { return time; }
}
public bool Notify
{
get{ return notify;}
}
public bool Stamp
{
get{ return stamp;}
}
public bool Bell
{
get { return bell;}
}
public bool Empty
{
get{ return empty;}
}
public NotifyEvent(Hashtable attributes)
{
source = Util.Database[ attributes["SOURCE"] ];
eventStr = attributes["EVENT"] as string;
command = attributes["COMMAND"] == null ? "" : attributes["COMMAND"] as string;
notify = attributes["NOTIFY"] == null ? false : true;
bell = attributes["BELL"] == null ? false : true;
stamp = attributes["STAMP"] == null ? false : true;
empty = attributes["EMPTY"] == null ? false : true;
valueStr = empty ? "" : attributes["VALUE"] as string;
if(attributes["RECIPS"] != null)
{
string[] recipHandles = ((string)attributes["RECIPS"]).Split(new char[] {','});
recipients = new ILilyObject[ recipHandles.Length];
for(int i = 0; i < recipients.Length; i++)
{
recipients[i] = Util.Database[ recipHandles[i] ] as ILilyObject;
}
}
time = Util.ConvertFromUnixTime(attributes["TIME"] as string);
}
}
}