home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / NexIRC_v2_2222363312012.psc / clsChannel.cls < prev    next >
Text File  |  2006-12-03  |  12KB  |  324 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "clsIRCServer_Channel"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
  15. Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
  16. Option Explicit
  17. Option Base 1
  18. Public Name As String
  19. Public Topic As String
  20. Public Modes As New Collection
  21. Public TopicSetOn As Long
  22. Public TopicSetBy As String
  23. Public Index As Long
  24. Public Password As String
  25. Public UserLevels As New Collection
  26. Public Invited As New Collection
  27. Public Key As String
  28. Public Limit As Integer
  29. Public All As New Collection
  30. Public Ops As New Collection
  31. Public Voices As New Collection
  32. Public NormUsers As New Collection
  33. Public Bans As New Collection
  34. Public Exceptions As New Collection
  35. Public Invites As New Collection
  36.  
  37. Public Property Get lUserCount() As Long
  38. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  39. lUserCount = NormUsers.Count + Ops.Count + Voices.Count
  40. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Property Get lUserCount() As Long"
  41. End Property
  42.  
  43. Public Property Get GetAll() As String
  44. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  45. Dim i As Long
  46. For i = 1 To All.Count
  47.     GetAll = GetAll & " " & All.Item(i)
  48. Next i
  49. GetAll = Trim(GetAll)
  50. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Property Get GetAll() As String"
  51. End Property
  52.  
  53. Public Property Get GetOps() As String
  54. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  55. Dim i As Long
  56. For i = 1 To Ops.Count
  57.     GetOps = GetOps & " @" & Ops.Item(i)
  58. Next i
  59. GetOps = Trim(GetOps)
  60. If GetOps <> "" Then GetOps = GetOps & " "
  61. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Property Get GetOps() As String"
  62. End Property
  63.  
  64. Public Property Get GetVoices() As String
  65. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  66. Dim i As Long
  67. For i = 1 To Voices.Count
  68.     GetVoices = GetVoices & " +" & Voices.Item(i)
  69. Next i
  70. GetVoices = Trim(GetVoices)
  71. If GetVoices <> "" Then GetVoices = GetVoices & " "
  72. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Property Get GetVoices() As String"
  73. End Property
  74.  
  75. Public Property Get GetNorms() As String
  76. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  77. Dim i As Long
  78. For i = 1 To NormUsers.Count
  79.     GetNorms = GetNorms & " " & NormUsers.Item(i)
  80. Next i
  81. GetNorms = Trim(GetNorms)
  82. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Property Get GetNorms() As String"
  83. End Property
  84.  
  85. Public Function IsOp(Nick As String) As Boolean
  86. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  87. Dim i As Long
  88. For i = 1 To Ops.Count
  89.     If Ops(i) = Nick Then
  90.         IsOp = True
  91.         Exit Function
  92.     End If
  93. Next i
  94. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsOp(Nick As String) As Boolean"
  95. End Function
  96.  
  97. Public Function IsVoice(Nick As String) As Boolean
  98. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  99. Dim i As Long
  100. For i = 1 To Voices.Count
  101.     If Voices(i) = Nick Then
  102.         IsVoice = True
  103.         Exit Function
  104.     End If
  105. Next i
  106. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsVoice(Nick As String) As Boolean"
  107. End Function
  108.  
  109. Public Function IsNorm(Nick As String) As Boolean
  110. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  111. Dim i As Long
  112. For i = 1 To NormUsers.Count
  113.     If NormUsers(i) = Nick Then
  114.         IsNorm = True
  115.         Exit Function
  116.     End If
  117. Next i
  118. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsNorm(Nick As String) As Boolean"
  119. End Function
  120.  
  121. Public Function IsMode(Mode As String) As Boolean
  122. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  123. Dim i As Long
  124. For i = 1 To Modes.Count
  125.     If Modes(i) = Mode Then
  126.         IsMode = True
  127.         Exit Function
  128.     End If
  129. Next i
  130. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsMode(Mode As String) As Boolean"
  131. End Function
  132.  
  133. Public Function IsOnChan(NickName As String) As Boolean
  134. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  135. Dim i As Long
  136. For i = 1 To All.Count
  137.     If All(i) = NickName Then
  138.         IsOnChan = True
  139.         Exit Function
  140.     End If
  141. Next i
  142. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsOnChan(NickName As String) As Boolean"
  143. End Function
  144.  
  145. Public Function IsBanned(User As clsIRCServer_User) As Boolean
  146. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  147. Dim i As Long
  148. For i = 1 To Bans.Count
  149.     If (User.Nick & "!" & User.ident & "@" & User.DNS) Like Bans(i) Then
  150.         IsBanned = True
  151.         Exit Function
  152.     End If
  153. Next i
  154. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsBanned(User As clsIRCServer_User) As Boolean"
  155. End Function
  156.  
  157. Public Function IsBanned2(ID As String) As Boolean
  158. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  159. Dim i As Long
  160. For i = 1 To Bans.Count
  161.     If (ID Like Bans(i)) Then
  162.         IsBanned2 = True
  163.         Exit Function
  164.     End If
  165. Next i
  166. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsBanned2(ID As String) As Boolean"
  167. End Function
  168.  
  169. Public Property Get GetModesForFile()
  170. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  171. Dim i As Long
  172. For i = 1 To Modes.Count
  173.     GetModesForFile = GetModesForFile + Modes(i)
  174. Next i
  175. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Property Get GetModesForFile()"
  176. End Property
  177.  
  178. Public Property Get GetModes() As String
  179. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  180. Dim i As Long
  181. For i = 1 To Modes.Count
  182.     GetModes = GetModes + Modes(i)
  183. Next i
  184. If Key <> "" And Limit <> 0 Then
  185.     GetModes = GetModes & "lk " & Limit & " " & Key
  186. ElseIf Key <> "" And Limit = 0 Then
  187.     GetModes = GetModes & "k " & Key
  188. ElseIf Key = "" And Limit <> 0 Then
  189.     GetModes = GetModes & "l " & Limit
  190. End If
  191. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Property Get GetModes() As String"
  192. End Property
  193.  
  194. Public Sub AddToUserList(NickName As String, level As Long)
  195. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  196. UserLevels.Add NickName & " " & level, NickName
  197. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Sub AddToUserList(NickName As String, level As Long)"
  198. End Sub
  199.  
  200. Public Sub RemoveFromUserList(NickName As String)
  201. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  202. UserLevels.Remove NickName
  203. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Sub RemoveFromUserList(NickName As String)"
  204. End Sub
  205.  
  206. Public Sub GetUserListItem(Index, ByRef NickName As String, ByRef level As Long)
  207. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  208. NickName = UserLevels(Index)
  209. level = CLng(Mid(NickName, InStr(1, NickName, " ")))
  210. NickName = Replace(NickName, " " & level, "")
  211. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Sub GetUserListItem(Index, ByRef NickName As String, ByRef level As Long)"
  212. End Sub
  213.  
  214. Public Sub AddModes(NewModes As String)
  215. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  216. Dim i As Long
  217. For i = 1 To Len(NewModes)
  218.     Modes.Add Mid(NewModes, i, 1), Mid(NewModes, i, 1)
  219. Next i
  220. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Sub AddModes(NewModes As String)"
  221. End Sub
  222.  
  223. Public Function ULOp(Nick As String) As Boolean
  224. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  225. Dim User As clsIRCServer_User, level As Long
  226. Set User = NickToObject(Nick)
  227. Dim i As Long
  228. For i = 1 To UserLevels.Count
  229.     GetUserListItem i, Nick, level
  230.     If (Nick = User.Nick Or Nick = User.IdentifiedAs) And (level >= 100 And User.Identified) Then
  231.         ULOp = True
  232.     End If
  233. Next i
  234. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function ULOp(Nick As String) As Boolean"
  235. End Function
  236.  
  237. Public Function ULVoice(Nick As String) As Boolean
  238. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  239. Dim User As clsIRCServer_User, level As Long
  240. Set User = NickToObject(Nick)
  241. Dim i As Long
  242. For i = 1 To UserLevels.Count
  243.     GetUserListItem i, Nick, level
  244.     If (Nick = User.Nick Or Nick = User.IdentifiedAs) And (level = 50 And User.Identified) Then
  245.         ULVoice = True
  246.     End If
  247. Next i
  248. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function ULVoice(Nick As String) As Boolean"
  249. End Function
  250.  
  251. Public Function IsInvited(Nick As String) As Boolean
  252. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  253. Dim i As Long
  254. For i = 1 To Invited.Count
  255.     If Nick = Invited(i) Then
  256.         IsInvited = True
  257.         Invited.Remove i
  258.         Exit Function
  259.     End If
  260. Next i
  261. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsInvited(Nick As String) As Boolean"
  262. End Function
  263.  
  264. Public Function IsInvited2(User As clsIRCServer_User) As Boolean
  265. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  266. Dim i As Long
  267. For i = 1 To Invites.Count
  268.     If (User.Nick & "!" & User.ident & "@" & User.DNS) Like Invites(i) Then
  269.         IsInvited2 = True
  270.         Exit Function
  271.     End If
  272. Next i
  273. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsInvited2(User As clsIRCServer_User) As Boolean"
  274. End Function
  275.  
  276. Public Function IsException(User As clsIRCServer_User) As Boolean
  277. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  278. Dim i As Long
  279. For i = 1 To Exceptions.Count
  280.     If (User.Nick & "!" & User.ident & "@" & User.DNS) Like Exceptions(i) Then
  281.         IsException = True
  282.         Exit Function
  283.     End If
  284. Next i
  285. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsException(User As clsIRCServer_User) As Boolean"
  286. End Function
  287.  
  288. Public Function IsException2(ID As String) As Boolean
  289. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  290. Dim i As Long
  291. For i = 1 To Exceptions.Count
  292.     If (ID Like Exceptions(i)) Then
  293.         IsException2 = True
  294.         Exit Function
  295.     End If
  296. Next i
  297. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsException2(ID As String) As Boolean"
  298. End Function
  299.  
  300. Public Function IsInvited3(ID As String) As Boolean
  301. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  302. Dim i As Long
  303. For i = 1 To Invites.Count
  304.     If (ID Like Invites(i)) Then
  305.         IsInvited3 = True
  306.         Exit Function
  307.     End If
  308. Next i
  309. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Public Function IsInvited3(ID As String) As Boolean"
  310. End Function
  311.  
  312. Private Sub Class_Initialize()
  313. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  314. lChanCount = lChanCount + 1
  315. lChannelsUBound = lChannelsUBound + 1
  316. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Private Sub Class_Initialize()"
  317. End Sub
  318.  
  319. Private Sub Class_Terminate()
  320. If lSettings.sHandleErrors = True Then On Local Error Resume Next
  321. lChanCount = lChanCount - 1
  322. If Err.Number <> 0 Then ProcessRuntimeError Err.Description, Err.Number, "Private Sub Class_Terminate()"
  323. End Sub
  324.