Advertisement
SpecialG

Ban Protection

Dec 23rd, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.51 KB | None | 0 0
  1. dialog Protection {
  2. title "AV2 Protection Control"
  3. size 160 175 152 159
  4. option dbu
  5. tab "Ban Protection", 1, 3 0 215 155
  6. tab "Kick Protection", 2
  7. tab "Deop Protection", 3
  8. box "Action to take when banned", 4, 5 17 146 125, tab 1
  9. list 5, 9 25 135 50, tab 1
  10. button "Add", 6, 9 75 25 10, tab 1
  11. button "Exceptions",7, 76 143 35 10
  12. button "Clear", 8, 120 75 25 10, tab 1
  13. text "Kick Message:", 9, 10 90 47 10, tab 1
  14. edit %BKMessage, 10, 57 90 90 10, autohs, tab 1
  15. button "Close", 11,40 143 25 10, cancel
  16. text "Channel Message:", 12, 9 102 46 10, tab 1
  17. edit %BCMessage, 13, 57 102 90 10, autohs, tab 1
  18. text "Notice Message:", 14, 9 115 46 10, tab 1
  19. edit %BNMessage, 15, 57 114 90 10, autohs, tab 1
  20. box "Action to take when kicked", 16, 5 17 146 125, tab 2
  21. list 17, 9 25 135 50, tab 2
  22. text "Kick Message:", 18, 10 90 47 10, tab 2
  23. edit %KKMessage, 19, 57 90 90 10, autohs, tab 2
  24. button "Add", 20, 9 75 25 10, tab 2
  25. button "Clear", 22, 120 75 25 10, tab 2
  26. text "Channel Message:", 23, 9 102 46 10, tab 2
  27. edit %KCMessage, 24, 57 102 90 10, autohs, tab 2
  28. edit %KNMessage, 25, 57 114 90 10, autohs, tab 2
  29. text "Notice Message:", 26, 9 115 46 10, tab 2
  30. text "Query Message:", 27, 9 127 46 10, tab 1
  31. edit %BQMessage, 28, 57 125 90 10, autohs, tab 1
  32. text "Query Message:", 29, 9 127 46 10, tab 2
  33. edit %KQMessage, 30, 57 125 90 10, autohs, tab 2
  34. box "Action to take when kicked", 31, 5 17 146 125, tab 3
  35. list 32, 9 25 135 50, tab 3
  36. button "Add", 33, 9 75 25 10, tab 3
  37. text "Kick Message:", 34, 10 90 47 10, tab 3
  38. text "Channel Message:", 35, 9 102 46 10, tab 3
  39. text "Notice Message:", 36, 9 115 46 10, tab 3
  40. text "Query Message:", 37, 9 127 46 10, tab 3
  41. edit %DQMessage, 38, 57 125 90 10, autohs, tab 3
  42. edit %DNMessage, 39, 57 114 90 10, autohs, tab 3
  43. edit %DCMessage, 40, 57 102 90 10, autohs, tab 3
  44. edit %DKMessage, 41, 57 90 90 10, autohs, tab 3
  45. button "Clear", 43, 120 75 25 10, tab 3
  46. button "Enable", 44, 5 143 25 10
  47. button "Disable", 45, 123 143 25 10
  48. }
  49. on 1:dialog:Protection:init:0:{
  50. var %x 1, %y 1, %z 1, %a 1
  51. while (%x < 14) {
  52. if ($readini(Protection.ini,Ban,%x) == Y) { did -i $dname 5 %y %y $+ . $readini(Protection.ini,Instances,%x) | inc %y }
  53. if ($readini(Protection.ini,Kick,%x) == Y) { did -i $dname 17 %z %z $+ . $readini(Protection.ini,Instances,%x) | inc %z }
  54. if ($readini(Protection.ini,Deop,%x) == Y) { did -i $dname 32 %a %a $+ . $readini(Protection.ini,Instances,%x) | inc %a }
  55. inc %x
  56. }
  57. }
  58. on 1:dialog:Protection:sclick:*:{
  59. if ($did == 6) dialog -m ProtectionList ProtectionList
  60. if (($did == 7) && (!$dialog(ProtectionException))) .dialog -m ProtectionException ProtectionException
  61. if ($did == 20) { dialog -m ProtectionList ProtectionList | did -c ProtectionList 2 }
  62. if ($did == 33) { dialog -m ProtectionList ProtectionList | did -c ProtectionList 3 }
  63. if ($did == 8) {
  64. did -r $dname 5
  65. var %x 1
  66. while (%x < 14) {
  67. writeini Protection.ini Ban %x N
  68. inc %x
  69. }
  70. }
  71. if ($did == 22) {
  72. did -r $dname 17
  73. var %x 1
  74. while (%x < 14) {
  75. writeini Protection.ini Kick %x N
  76. inc %x
  77. }
  78. }
  79. if ($did == 43) {
  80. did -r $dname 32
  81. var %x 1
  82. while (%x < 14) {
  83. writeini Protection.ini Deop %x N
  84. inc %x
  85. }
  86. }
  87. if ($did == 11) {
  88. set %BKMessage $did(10)
  89. set %BCMessage $did(13)
  90. set %KKMessage $did(19)
  91. set %BNMessage $did(15)
  92. set %KCMessage $did(24)
  93. set %KNMessage $did(25)
  94. set %BQMessage $did(28)
  95. set %KQMessage $did(30)
  96. set %DQMessage $did(38)
  97. set %DNMessage $did(39)
  98. set %DCMessage $did(40)
  99. set %DKMessage $did(41)
  100. }
  101. if ($did == 44) set %Protection on
  102. if ($did == 45) set %Protection off
  103. }
  104. alias Protection dialog -m Protection Protection
  105. dialog ProtectionList {
  106. title "AV2 Protecting Actions"
  107. size -1 -1 162 106
  108. option dbu
  109. tab "On Ban Actions", 1, 1 0 158 102
  110. tab "On Kick Actions", 2
  111. tab "On Deop Actions", 3
  112. list 4, 8 22 143 73, tab 1
  113. box "List of Actions", 5, 5 14 150 85, tab 1
  114. list 6, 8 22 143 73, tab 2
  115. box "List of Actions", 7, 5 14 150 85, tab 2
  116. list 8, 8 22 143 73, tab 3
  117. box "List of Actions", 9, 5 14 150 85, tab 3
  118. button "Close", 10, 70 85 25 13, cancel
  119. }
  120. on 1:dialog:ProtectionList:init:0:{
  121. var %x 1
  122. while (%x < 14) {
  123. did -i $dname 4 %x %x $+ . $readini(Protection.ini,Instances,%x)
  124. did -i $dname 6 %x %x $+ . $readini(Protection.ini,Instances,%x)
  125. did -i $dname 8 %x %x $+ . $readini(Protection.ini,Instances,%x)
  126. inc %x
  127. }
  128. }
  129. on 1:dialog:ProtectionList:sclick:*:{
  130. if ($did == 4) {
  131. did -i Protection 5 $calc($did(Protection,5).lines + 1) $calc($did(Protection,5).lines + 1) $+ . $gettok($did(4).seltext,2-,32)
  132. writeini Protection.ini Ban $did(4).sel Y
  133. }
  134. if ($did == 6) {
  135. did -i Protection 17 $calc($did(Protection,17).lines + 1) $calc($did(Protection,17).lines + 1) $+ . $gettok($did(6).seltext,2-,32)
  136. writeini Protection.ini Kick $did(6).sel Y
  137. }
  138. if ($did == 8) {
  139. did -i Protection 32 $calc($did(Protection,32).lines + 1) $calc($did(Protection,32).lines + 1) $+ . $gettok($did(8).seltext,2-,32)
  140. writeini Protection.ini Deop $did(8).sel Y
  141. }
  142. }
  143. dialog ProtectionException {
  144. title "AV2 Protection Exception List"
  145. size -1 -1 196 75
  146. option dbu
  147. box "Nicks not to trigger on", 1, 1 1 96 75
  148. combo 2, 3 9 89 50, size
  149. button "Add", 3, 4 61 24 11
  150. button "Delete", 4, 35 61 24 11
  151. button "Clear", 5, 67 61 24 11
  152. box "Channels not to trigger on", 6, 100 1 96 75
  153. combo 7, 102 9 89 50, size
  154. button "Add", 8, 103 61 24 11
  155. button "Delete", 9, 134 61 24 11
  156. button "Clear", 10, 166 61 24 11
  157. }
  158. on 1:dialog:ProtectionException:sclick:*:{
  159. if ($did == 3) {
  160. if (!$did(2)) { set %AMSGError Please enter a nick to add to the exception list. | dialog -m AMSGError AMSGError | return }
  161. if ($readini(Protection.ini,Nicks,$did(2))) { set %AMSGError The specified nick already exists in the exception list. | dialog -m AMSGError AMSGError | return }
  162. writeini Protection.ini Nicks $did(2) $Fulldate
  163. dialog -x $dname
  164. dialog -m ProtectionException ProtectionException
  165. }
  166. if ($did == 4) {
  167. if (!$did(2)) { set %AMSGError Please enter a nick to delete from the exception list. | dialog -m AMSGError AMSGError | return }
  168. if (!$readini(Protection.ini,Nicks,$did(2))) { set %AMSGError The specified nick does not exists in the exception list. | dialog -m AMSGError AMSGError | return }
  169. remini Protection.ini Nicks $did(2)
  170. dialog -x $dname
  171. dialog -m ProtectionException ProtectionException
  172. }
  173. if ($did == 5) { remini Protection.ini Nicks | dialog -x $dname | dialog -m ProtectionException ProtectionException }
  174. if ($did == 8) {
  175. if (!$did(7)) { set %AMSGError Please enter a channel to add to the exception list. | dialog -m AMSGError AMSGError | return }
  176. if ($readini(Protection.ini,Channels,$iif($left($did(7),1) == $chr(35),$did(7),$chr(35) $+ $did(7)))) { set %AMSGError The specified channel already exists in the exception list. | dialog -m AMSGError AMSGError | return }
  177. writeini Protection.ini Channels $iif($left($did(7),1) == $chr(35),$did(7),$chr(35) $+ $did(7)) $Fulldate
  178. dialog -x $dname
  179. dialog -m ProtectionException ProtectionException
  180. }
  181. if ($did == 9) {
  182. if (!$did(7)) { set %AMSGError Please enter a channel to delete from the exception list. | dialog -m AMSGError AMSGError | return }
  183. if (!$readini(Protection.ini,Channels,$iif($left($did(7),1) == $chr(35),$did(7),$chr(35) $+ $did(7)))) { set %AMSGError The specified channel does not exists in the exception list. | dialog -m AMSGError AMSGError | return }
  184. remini Protection.ini Channels $iif($left($did(7),1) == $chr(35),$did(7),$chr(35) $+ $did(7))
  185. dialog -x $dname
  186. dialog -m ProtectionException ProtectionException
  187. }
  188. if ($did == 10) { remini Protection.ini Channels | dialog -x $dname | dialog -m ProtectionException ProtectionException }
  189. }
  190. on 1:dialog:ProtectionException:init:0:{
  191. var %x 1
  192. while ($ini(Protection.ini,Nicks,%x)) {
  193. did -i $dname 2 %x $ini(Protection.ini,Nicks,%x)
  194. inc %x
  195. }
  196. %x = 1
  197. while ($ini(Protection.ini,Channels,%x)) {
  198. did -i $dname 7 %x $ini(Protection.ini,Channels,%x)
  199. inc %x
  200. }
  201. }
  202. alias CreateProtectionIni {
  203. var %x 1
  204. writeini Protection.ini Instances 1 Have ChanServ unban you from the channel | writeini Protection.ini Instances 2 Rejoin the channel | writeini Protection.ini Instances 3 Have ChanServ ban the user
  205. writeini Protection.ini Instances 4 Have ChanServ kick the user | writeini Protection.ini Instances 5 Have ChanServ deop the user | writeini Protection.ini Instances 6 Deop the user yourself
  206. writeini Protection.ini Instances 7 Unban yourself manually | writeini Protection.ini Instances 8 Ban the user yourself | writeini Protection.ini Instances 9 Kick the user yourself
  207. writeini Protection.ini Instances 10 Message the channel | writeini Protection.ini Instances 11 Notice the user | writeini Protection.ini Instances 12 Message the user
  208. writeini Protection.ini Instances 13 Have ChanServ op you
  209. while (%x < 14) {
  210. writeini Protection.ini Ban %x N
  211. Writeini Protection.ini Kick %x N
  212. Writeini Protection.ini Deop %x N
  213. inc %x
  214. }
  215. }
  216. on 1:ban:*:{
  217. if ($nick == $me) return
  218. if ((%Protection == off) || ($readini(Protection.ini,Nicks,$nick)) || ($readini(Protection.ini,Channels,#))) return
  219. if ($bnick == $me) { ProtectionAction Ban # $nick | return }
  220. var %x -1
  221. while (%x < 10) {
  222. if ($banmask isin $address($me,%x)) { set %BannedToo 1 | ProtectionAction Ban # $nick | return }
  223. inc %x
  224. }
  225. }
  226. on 1:kick:#:{
  227. if ($nick == $me) return
  228. if ((%Protection == off) || ($readini(Protection.ini,Nicks,$nick)) || ($readini(Protection.ini,Channels,#))) return
  229. if (($knick == $me) && (%BannedToo != 1)) ProtectionAction Kick # $nick
  230. }
  231. on 1:deop:#:{
  232. if ($nick == $me) return
  233. if ((%Protection == off) || ($readini(Protection.ini,Nicks,$nick)) || ($readini(Protection.ini,Channels,#))) return
  234. if ($onick == $me) ProtectionAction Deop # $nick
  235. }
  236. alias ProtectionAction {
  237. unset %BannedToo
  238. mode $2 -eeee $3 $address($3,2) $address($3,3) $address($3,4)
  239. if ($readini(protection.ini,$1,1) == Y) cs unban $2
  240. if ($readini(protection.ini,$1,2) == Y) { set %ProtectionJoin $1- | join $2 }
  241. if ($readini(protection.ini,$1,3) == Y) cs ban $2 $3 $($+(%,$left($1,1),KMessage),2)
  242. if ($readini(protection.ini,$1,4) == Y) cs kick $2 $3 $($+(%,$left($1,1),KMessage),2)
  243. if ($readini(protection.ini,$1,5) == Y) cs deop $2 $3
  244. if ($1 != kick) ProtectionActionS $1-
  245. else set %ProtectionJoin $1-
  246. }
  247. alias ProtectionActionS {
  248. unset %BannedToo
  249. if ($readini(protection.ini,$1,13) == Y) cs op $2
  250. mode $2 -eeee $2 $address($3,5) $address($3,6) $address($3,7) $address($3,8)
  251. if ($readini(protection.ini,$1,6) == Y) mode $2 -o $3
  252. if ($readini(protection.ini,$1,7) == Y) mode $2 -bb $me $banmask
  253. if ($readini(protection.ini,$1,8) == Y) mode $2 +b $address($3,2)
  254. if ($readini(protection.ini,$1,9) == Y) kick $2 $3 %BKMessage
  255. if (($readini(protection.ini,$1,10) == Y) && (%BCMessage)) msg $2 $($+(%,$left($1,1),CMessage),2)
  256. if (($readini(protection.ini,$1,11) == Y) && (%BNMessage)) notice $3 $($+(%,$left($1,1),NMessage),2)
  257. if (($readini(protection.ini,$1,12) == Y) && (%BQMessage)) msg $3 $($+(%,$left($1,1),QMessage),2)
  258. }
  259. on 1:join:#:{
  260. if (($nick == $me) && (%Protection == on) && ($gettok(%ProtectionJoin,3,32)) && ($gettok(%ProtectionJoin,2,32) == #)) { .timer 1 1 ProtectionActionS %ProtectionJoin | unset %ProtectionJoin }
  261. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement