home *** CD-ROM | disk | FTP | other *** search
/ Enter 2003: The Beautiful Scenery / enter-parhaat-2003.iso / files / airc_setup.exe / data1.cab / Script_-_Away / away.vbs
Encoding:
Text File  |  2002-07-26  |  3.0 KB  |  122 lines

  1. Dim ignoring
  2. Dim ignorednicks ';nick1;nick2;nick3;...;
  3. Dim warnednicks 'goes for the same
  4.  
  5. Sub airc_init(ScName,ScFunc)
  6. ScName = "away"
  7. ScFunc = "away functions"
  8. aecho "[away] away functions script loaded!", , True
  9. End Sub
  10.  
  11. Sub airc_close()
  12. resetnicks
  13. aecho "[away] away functions script unloaded!", , True
  14. End Sub
  15.  
  16. 'Custom subs
  17.  
  18. Sub resetnicks()
  19. Dim c
  20. Dim v
  21. c = 0
  22. if isempty(warnednicks) then warnednicks = ";"
  23. if isempty(ignorednicks) then ignorednicks = ";"
  24. if not warnednicks = ";" then
  25. v = Split(warnednicks, ";")
  26. warnednicks = ""
  27. for c = LBound(v) + 1 To UBound(v) - 2
  28. warnednicks = warnednicks & v(c)
  29. If Not c = UBound(v) - 2 Then warnednicks = warnednicks & ", " Else warnednicks = warnednicks & " and "
  30. Next
  31. warnednicks = warnednicks & v(c)
  32. aecho "[away] " & warnednicks & " has been warned.", , True
  33. end if
  34. if not ignorednicks = ";" then
  35. v = Split(ignorednicks, ";")
  36. ignorednicks = ""
  37. for c = LBound(v) + 1 To UBound(v) - 2
  38. ignorednicks = ignorednicks & v(c)
  39. If Not c = UBound(v) - 2 Then ignorednicks = ignorednicks & ", " Else ignorednicks = ignorednicks & " and "
  40. remignore v(c), "all" 'remove ignore (very important)
  41. Next
  42. ignorednicks = ignorednicks & v(c)
  43. remignore v(c), "all"
  44. aecho "[away] " & ignorednicks & " has been ignored.", , True
  45. aecho "[away] Ignores on " & ignorednicks & " has been removed.",,true
  46. end if
  47. warnednicks = ";"
  48. ignorednicks = ";"
  49. End Sub
  50.  
  51. Sub resetall()
  52. ignoring = false
  53. warnednicks = ";"
  54. ignorednicks = ";"
  55. resetnicks
  56. End Sub
  57.  
  58. Sub autoaway(text)
  59. alias_away false, text
  60. End Sub
  61.  
  62. Sub autoback()
  63. alias_back false, ""
  64. End Sub
  65.  
  66. 'End of custom subs
  67.  
  68. Sub in_msg(retval, text, nick)
  69. If Not ignoring Then Exit Sub
  70. If ((not InStr(1, lcase(warnednicks), ";" & LCase(nick) & ";") = 0) and (InStr(1, lcase(ignorednicks), ";" & LCase(nick) & ";") = 0)) then
  71. putmsg "[away] you have been warned - you are now ignored.", nick
  72. ignorednicks = ignorednicks & nick & ";"
  73. putignore nick, "all"
  74. ElseIf ((InStr(1, lcase(warnednicks), ";" & LCase(nick) & ";") = 0) and (InStr(1, lcase(ignorednicks), ";" & LCase(nick) & ";") = 0)) then
  75. warnednicks = warnednicks & nick & ";"
  76. putmsg "[away] please do not disturb.", nick
  77. closequery nick
  78. End If
  79. retval = True
  80. End Sub
  81.  
  82. Sub alias_away(retval, text)
  83. if text = "" then 'reset away
  84. alias_back retval, text
  85. exit sub
  86. end if
  87. if isempty(ignoring) then resetall
  88. if not ignoring then
  89. ignoring = True
  90. aecho "[away] protection enabled", , True
  91. resetnicks
  92. end if
  93. End Sub
  94.  
  95. Sub alias_back(retval, text)
  96. if isempty(ignoring) then resetall
  97. if ignoring then
  98. ignoring = False
  99. aecho "[away] protection disabled", , True
  100. resetnicks
  101. end if
  102. End Sub
  103.  
  104. sub alias_ignoreon(retval, text)
  105. if isempty(ignoring) then resetall
  106. if not ignoring then
  107. ignoring = true
  108. aecho "[away] protection enabled", , True
  109. resetnicks
  110. end if
  111. retval = true
  112. end sub
  113.  
  114. sub alias_ignoreoff(retval, text)
  115. if isempty(ignoring) then resetall
  116. if ignoring then
  117. ignoring = False
  118. aecho "[away] protection disabled", , True
  119. resetnicks
  120. end if
  121. retval = true
  122. end sub