-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclsDataHandler.cls
309 lines (280 loc) · 10.3 KB
/
clsDataHandler.cls
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "clsDataHandler"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public Sub BeginParse(strdata)
Dim strStrings() As String, I
SplitStr strdata, strStrings, vbCrLf
For I = 1 To UBound(strStrings)
Parse strStrings(I)
Next I
End Sub
Public Sub Parse(ByVal strdata As String)
On Error Resume Next
Dim strData1, strData2, I
Dim strArgs() As String
If Left(strdata, 1) = Chr(10) Then
strdata = Right(strdata, Len(strdata) - 1)
End If
If Val(Left(strdata, 4)) < 1001 Or Val(Left(strdata, 4)) > 3000 Then
Exit Sub
End If
I = InStr(1, strdata, Chr(34), vbBinaryCompare)
If I <> 0 Then
strData1 = Left(strdata, I - 2)
strData2 = Mid(strdata, I + 1, Len(strdata) - I - 1)
Else
strData1 = strdata
strData2 = ""
End If
SplitStr strData1, strArgs(), " "
Select Case Val(strArgs(1))
Case 1005
EID_Talk strArgs(3), strArgs(4), strData2
Exit Sub
Case 1023
EID_Emote strArgs(3), strArgs(4), strData2
Exit Sub
Case 1007
EID_Channel strData2
Exit Sub
Case 1001
EID_User strArgs(3), strArgs(4), strArgs(5)
Exit Sub
Case 1002
EID_Join strArgs(3), strArgs(4), strArgs(5)
Exit Sub
Case 1003
EID_Leave strArgs(3), strArgs(4)
Exit Sub
Case 1010
EID_SendWhisper strArgs(3), strArgs(4), strData2
Exit Sub
Case 1004
EID_RecvWhisper strArgs(3), strArgs(4), strData2
Exit Sub
Case 1016, 1018, 300
EID_Info strData2
Exit Sub
Case 1009
EID_Flags strArgs(3), strArgs(4)
Exit Sub
Case 1006
EID_Broadcast strData2
Exit Sub
Case 1019
EID_Error strData2
Exit Sub
Case 2010
EID_Name strArgs(3)
Exit Sub
Case 1013
EID_ChannelFull strData2
Exit Sub
Case 1014
EID_ChannelNotExist strData2
Exit Sub
Case 1015
EID_ChannelRestricted strData2
Exit Sub
Case 2000
EID_Null strData2
Exit Sub
Case Else
EID_Unknown strdata
Exit Sub
End Select
End Sub
Private Sub EID_Unknown(strText)
AddTimeStamp frmMain.txtChan
If Left$(strText, 15) = "Login incorrect" Then
AddRTB frmMain.txtChan, clrBotInfo, "Your Login is Incorrect"
Else
AddRTB frmMain.txtChan, clrBotInfo, strText
End If
End Sub
Private Sub EID_User(strUser, strFlag, strProduct)
Dim s As Long
s = CLng("&H" & strFlag)
If (PrepareCheck(strUser) = PrepareCheck(IniName)) And ((s = 2) Or (s = 18)) Then
hasOps = True
End If
End Sub
Private Sub EID_Join(strUser, strFlag, strProduct)
frmMain.lvChan.ListItems.Add frmMain.lvChan.ListItems.Count + 1, , strUser, , GetIconCode(strProduct, CLng("&H" & strFlag))
frmMain.txtCLabel.text = curChan & " (" & frmMain.lvChan.ListItems.Count & ")"
If Mid$(strFlag, 4, 1) = "1" Or Mid$(strFlag, 4, 1) = "2" Then
frmMain.lvChan.ListItems.Item(frmMain.lvChan.ListItems.Count).ForeColor = clrLVOps
Else
frmMain.lvChan.ListItems.Item(frmMain.lvChan.ListItems.Count).ForeColor = clrLVUser
End If
If IniShowEIDJoinLeave Then
AddTimeStamp frmMain.txtChan
AddRTB frmMain.txtChan, clrUserInfo, strUser & " has joined the channel using " & strProduct & "."
End If
If hasOps = True And lockDown = True Then
If Database.CheckSafelist(PrepareCheck(strUser)) = False Then
Queue.Enqueue "/ban " & strUser & " Lockdown is on." & vbCrLf
End If
End If
End Sub
Private Sub EID_Leave(strUser, strFlag)
frmMain.lvChan.ListItems.Remove (frmMain.lvChan.FindItem(strUser).index)
frmMain.txtCLabel.text = curChan & " (" & frmMain.lvChan.ListItems.Count & ")"
If IniShowEIDJoinLeave Then
AddTimeStamp frmMain.txtChan
AddRTB frmMain.txtChan, clrUserInfo, strUser & " has left the channel."
End If
End Sub
Private Sub EID_RecvWhisper(strUser, strFlag, strText)
' Dim i As Integer
' For i = 1 To colWBox.Count
' If colWBox.Item(i).Visible = True Then
' If PrepareCheck(strUser) = PrepareCheck(colWBox.Item(i).Caption) Then
' colWBox.Item(i).HandleWBox "[" & Time & "] " & "<" & strUser & "> ", strText & vbCrLf, 0
' Exit Sub
' End If
' End If
' Next i
AddTimeStamp frmMain.txtWhisper
AddRTB frmMain.txtWhisper, clrChatHeadings, "<From: " & strUser & "> ", clrWhisperTxt, strText
If Left$(strText, 1) = IniTrigger Then
CommandHandler.ParseCommand strUser, Mid$(strText, 2, Len(strText) - 1)
End If
End Sub
Private Sub EID_Talk(strUser, strFlag, strText)
' If IniFilter = 1 Then
' Dim i As Integer
' For i = 0 To UBound(FilterList)
' If Battlenet2.PrepareCheck(strText) Like Battlenet2.PrepareCheck(FilterList(i)) Then
' Exit Sub
'' End If
' Next i
' End If
AddTimeStamp frmMain.txtChan
If Mid$(strFlag, 4, 1) = "2" Or Mid$(strFlag, 4, 1) = "1" Then
AddRTB frmMain.txtChan, clrOpHeadings, "<" & strUser & "> ", clrChat, strText
Else
AddRTB frmMain.txtChan, clrChatHeadings, "<" & strUser & "> ", clrChat, strText
End If
If Left$(strText, 1) = IniTrigger Then
CommandHandler.ParseCommand strUser, Mid$(strText, 2, Len(strText) - 1)
End If
If PrepareCheck(strText) = "?trigger" Or _
PrepareCheck(strText) = "?trig" Or _
PrepareCheck(strText) = "?t" Then
CommandHandler.ParseCommand strUser, Mid$(strText, 2, Len(strText) - 1)
End If
End Sub
Private Sub EID_Broadcast(strText)
AddTimeStamp frmMain.txtChan
AddRTB frmMain.txtChan, clrAlert, strText & vbCrLf
End Sub
Private Sub EID_Channel(strText)
hasOps = False
UserDesignated = ""
AddTimeStamp frmMain.txtChan
AddRTB frmMain.txtChan, clrUserInfo, "Joined Channel: " & strText
curChan = strText
frmMain.Caption = " Game Announcer " & App.Major & "." & App.Minor & " (Build: " & App.Revision & ") User: [" & IniName & "] on server " & IniServer
'If (IniOpLog = 1) And (opBool = True) And (PrepareCheck(strText) = PrepareCheck(IniHome)) Then
' opBool = False
' frmBot.tmrOp.Enabled = True
' frmBot.HandleQueue "/who " & IniOpChan1
' frmBot.HandleQueue "/who " & IniOpChan2
' End If
End Sub
Private Sub EID_Flags(strUser, strFlag)
Dim s As Long
s = CLng("&H" & strFlag)
Dim I As Integer
On Error Resume Next
For I = 0 To frmMain.lvChan.ListItems.Count
If frmMain.lvChan.ListItems(I).text = strUser Then
If strFlag = "0010" Then
frmMain.lvChan.ListItems.Remove I
frmMain.lvChan.ListItems.Add I, , strUser, , 2
frmMain.lvChan.ListItems(I).ForeColor = clrLVUser
Else
frmMain.lvChan.ListItems.Remove I
frmMain.lvChan.ListItems.Add I, , strUser, , GetFlagCode(s)
If GetFlagCode(s) = 2 Then
frmMain.lvChan.ListItems(I).ForeColor = clrLVUser
Else
frmMain.lvChan.ListItems(I).ForeColor = clrLVOps
End If
End If
End If
Next I
If (PrepareCheck(strUser) = PrepareCheck(IniName)) Then
If ((s = 2) Or (s = 18)) Then
hasOps = True
Else
hasOps = False
End If
End If
End Sub
Private Sub EID_SendWhisper(strUser, strFlag, strText)
' Dim i As Integer
' For i = 1 To wboxCount
' If colWBox.Item(i).Visible = True Then
' If PrepareCheck(strUser) = PrepareCheck(colWBox.Item(i).Caption) Then
' colWBox.Item(i).HandleWBox "[" & Time & "] " & "<" & frmBot.strName & "> ", strText & vbCrLf, 1
' Exit Sub
' End If
' End If
' Next i
AddTimeStamp frmMain.txtWhisper
AddRTB frmMain.txtWhisper, clrUserHeadings, "<To: " & strUser & "> ", clrWhisperTxt, strText
End Sub
Private Sub EID_ChannelFull(strText)
AddTimeStamp frmMain.txtChan
AddRTB frmMain.txtChan, clrAlert, "Channel " & strText & " is full"
End Sub
Private Sub EID_ChannelNotExist(strText)
AddTimeStamp frmMain.txtChan
AddRTB frmMain.txtChan, clrAlert, "Channel " & strText & " does not exist"
End Sub
Private Sub EID_ChannelRestricted(strText)
AddTimeStamp frmMain.txtChan
AddRTB frmMain.txtChan, clrAlert, "Channel " & strText & " is restricted"
End Sub
Private Sub EID_Info(strText)
AddTimeStamp frmMain.txtChan
AddRTB frmMain.txtChan, clrTxtInfo, strText
' If (IniOpLog = 1) And (frmBot.tmrOp.Enabled = True) Then
' WriteLogEntry strText
' End If
End Sub
Private Sub EID_Error(strText)
AddTimeStamp frmMain.txtChan
AddRTB frmMain.txtChan, clrBotInfo, strText
End Sub
Private Sub EID_Emote(strUser, strFlag, strText)
'If IniFilter = 1 Then
' Dim i As Integer
' For i = 0 To UBound(FilterList)
' If Battlenet2.PrepareCheck(strText) Like Battlenet2.PrepareCheck(FilterList(i)) Then
' Exit Sub
' End If
' Next i
' End If
AddTimeStamp frmMain.txtChan
AddRTB frmMain.txtChan, clrEmote, "<" & strUser & " " & strText & ">"
End Sub
Private Sub EID_Name(strUser)
frmMain.Caption = " Game Announcer " & App.Major & "." & App.Minor & " (Build: " & App.Revision & ") User: [" & IniName & "] on server " & IniServer
AddTimeStamp frmMain.txtChan
AddRTB frmMain.txtChan, clrBotInfo, "Successfully logged in as " & strUser
End Sub
Private Sub EID_Null(strText)
End Sub