Advertisement
SaNCaK

mIRC Clonescanner Dialog

Apr 19th, 2014
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 8.69 KB | None | 0 0
  1. ;==== popup menus ====
  2. menu menubar,channel {
  3.   -
  4.   Clonescanner:clonescanner
  5.   -
  6. }
  7. ;==== custom aliases ====
  8. alias clonescanner {
  9.   set %mcl.chan $active
  10.   var %mcl.c, %mcl.i, %mcl.p, %mcl.t, %mcl.d, %mcl.total, %mcl.count2, %mclones
  11.   %mcl.i = 1
  12.   if ($dialog(clonescan)) { did -r clonescan 205,207 }
  13.   else { dialog -m clonescan clonescan }
  14.   %mcl.count2 = 0
  15.   :i
  16.   %mcl.t = $address($nick(#,%mcl.i),2)
  17.   if ($ialchan(%mcl.t,#,0) > 1) && (%mcl.t !isin %mcl.d) {
  18.     %mcl.p = 1
  19.     var %mcl.count = 0
  20.     :p
  21.     if ($ialchan(%mcl.t,#,%mcl.p).nick) {
  22.       inc %mcl.count
  23.       %mcl.c = %mcl.c $ifmatch
  24.       inc %mcl.p
  25.       inc %mcl.total
  26.       goto p
  27.     }
  28.     inc %mcl.count2
  29.     did -a clonescan 207 %mcl.t
  30.     did -a clonescan 205 %mcl.c
  31.     var %mcl.c
  32.     %mcl.d = %mcl.d %mcl.t
  33.   }
  34.   inc %mcl.i
  35.   if ($nick(#,%mcl.i)) goto i
  36.   if (%mcl.d) { did -a clonescan 202 %mcl.total | did -z clonescan 205,207 | halt }
  37.   did -a clonescan 202 None!
  38.   did -b clonescan 203,204,205,206,207,102,103,104,105
  39. }
  40. on *:JOIN:*:{
  41.   ;==== check IAL ====
  42.   if (($nick == $me) && (!$chan($chan).ial)) { .who $chan }
  43.   if (($nick != $me) && ($me isop $chan)) {
  44.     var %address = $address($nick,2)
  45.     if ($ialchan(%address,$chan,2)) {
  46.       var %i = 1, %mclones, %nick, %t = $ialchan(%address,$chan,0)
  47.       ;==== if it's your clone no need to kick it ====
  48.       if (%t == $address($me,0)) return
  49.       ;==== getting all nicks with that address ====
  50.       while (%i <= %t) {
  51.         %nick = $ialchan(%address,$chan,%i).nick
  52.         if (%nick isop $chan) { echo -a 4 ! Clones detected joining $chan $+ , but using same address as a channelop: %nick ( $+ %address $+ ). Operation aborted! | return }
  53.         %mclones = %mclones %nick
  54.         inc %i
  55.       }
  56.       ;==== doing the preferred action ====
  57.       if (%t > 1) {
  58.         if (e isin %mcl.oj) {
  59.           echo -a $chr(160)
  60.           echo -a Warning: clones detected joining $chan $+ : %mclones $+ , using address %address
  61.           echo -a $chr(160)
  62.         }
  63.         if (s isin %mcl.oj) { msg $chan Warning: clones detected joining $chan $+ : %mclones $+ , with address %address }
  64.         if (d isin %mcl.oj) { clonescanner }
  65.         if (k isin %mcl.oj) {
  66.           %i = 01
  67.           while (%i <= %t) {
  68.             .timer -m 1 1 kick $chan $gettok(%mclones,%i,32)
  69.             inc %i
  70.           }
  71.         }
  72.         if (b isin %mcl.oj) { ban $chan %address }
  73.         if (c isin %mcl.oj) {
  74.           ban $chan %address
  75.           %i = 1
  76.           while (%i <= %t) {
  77.             .timer -m 1 1 kick $chan $gettok(%mclones,%i,32)
  78.             inc %i
  79.           }
  80.         }
  81.         if (w isin %mcl.oj) {
  82.           %i = 1
  83.           while (%i <= %t) {
  84.             var %mcl.warn = $replace(%mcl.warning,@Nick@,$gettok(%mclones,%i,32),@chan@,$chan)
  85.             %mcl.warn
  86.             inc %i
  87.           }
  88.         }
  89.       }
  90.     }
  91.   }
  92.   elseif ($nick != $me) {
  93.     ;==== even if i'm not op, check anyway ====
  94.     var %address = $address($nick,2)
  95.     if ($ialchan(%address,$chan,2)) {
  96.       var %i = 1, %mclones, %nick, %t = $ialchan(%address,$chan,0)
  97.       while (%i <= %t) {
  98.         %nick = $ialchan(%address,$chan,%i).nick
  99.         %mclones = %mclones %nick
  100.         inc %i
  101.       }
  102.       if (%t > 1) {
  103.         if (e isin %mcl.oj) {
  104.           echo -a $chr(160)
  105.           echo -a Warning: clones detected joining $chan $+ : %mclones $+ , with address %address
  106.           echo -a $chr(160)
  107.         }
  108.         if (s isin %mcl.oj) { msg $chan Warning: clones detected joining $chan $+ : %mclones $+ , with address %address }
  109.         if (d isin %mcl.oj) { dialog -m clonescan clonescan }
  110.       }
  111.     }
  112.   }
  113. }
  114. ;==== dialog init ====
  115. on *:DIALOG:cledit:init:0:{
  116.   if (e isin %mcl.oj) { did -c cledit 3 }
  117.   if (s isin %mcl.oj) { did -c cledit 4 }
  118.   if (d isin %mcl.oj) { did -c cledit 5 }
  119.   if (k isin %mcl.oj) { did -c cledit 6 }
  120.   if (b isin %mcl.oj) { did -c cledit 7 }
  121.   if (c isin %mcl.oj) { did -c cledit 8 }
  122.   if (w isin %mcl.oj) { did -c cledit 9 }
  123.   if (n isin %mcl.oj) { did -c cledit 10 }
  124. }
  125. ;==== saving settings ====
  126. on *:dialog:cledit:sclick:101:{
  127.   unset %mcl.oj
  128.   set %mcl.msg $did(cledit,1)
  129.   set %mcl.warning $did(cledit,2)
  130.   if ($did(3).state == 1) { %mcl.oj = %mcl.oj $+ e }
  131.   if ($did(4).state == 1) { %mcl.oj = %mcl.oj $+ s }
  132.   if ($did(5).state == 1) { %mcl.oj = %mcl.oj $+ d }
  133.   if ($did(6).state == 1) { %mcl.oj = %mcl.oj $+ k }
  134.   if ($did(7).state == 1) { %mcl.oj = %mcl.oj $+ b }
  135.   if ($did(8).state == 1) { %mcl.oj = %mcl.oj $+ c }
  136.   if ($did(9).state == 1) { %mcl.oj = %mcl.oj $+ w }
  137.   if ($did(10).state == 1) { %mcl.oj = %mcl.oj $+ n }
  138. }
  139. ;==== selecting corresponding nicks with address (and the other way around too) ====
  140. on *:DIALOG:clonescan:sclick:205:did -c clonescan 207 $did(clonescan,205,1).sel
  141. on *:DIALOG:clonescan:sclick:207:did -c clonescan 205 $did(clonescan,207,1).sel
  142. ;==== dialog button "Kick" clones ====
  143. on *:DIALOG:clonescan:sclick:102:{
  144.   ; got clones selected?
  145.   if (!$did(clonescan,207).seltext) { echo -a You didn't select any clones | return }
  146.   if ($me !isop %mcl.chan) { echo -a You need operator status to do this. | return }
  147.   ; getting total number of clones to kick (%t)
  148.   var %i = 1, %t = $gettok($did(clonescan,205,1).seltext,0,32)
  149.   while (%i <= %t) {
  150.     .timer -m 1 1 kick %mcl.chan $gettok($did(clonescan,205,1).seltext,%i,32)
  151.     inc %i
  152.   }
  153. }
  154. ;==== dialog button "kickban" ====
  155. on *:DIALOG:clonescan:sclick:103:{
  156.   ; got clones selected?
  157.   if (!$did(clonescan,207).seltext) { echo -a You didn't select any clones | return }
  158.   if ($me !isop %mcl.chan) { echo -a You need operator status to do this. | return }
  159.   ; getting total number of clones to kick (%t)
  160.   var %i = 1, %t = $gettok($did(clonescan,205,1).seltext,0,32)
  161.   ; ban address
  162.   ban %mcl.chan $did(clonescan,207).seltext
  163.   ; kick 'em!
  164.   while (%i <= %t) {
  165.     .timer -m 1 1 kick %mcl.chan $gettok($did(clonescan,205,1).seltext,%i,32)
  166.     inc %i
  167.   }
  168. }
  169. ;==== dialog button "ban" ====
  170. on *:DIALOG:clonescan:sclick:104:{
  171.   ; got clones selected?
  172.   if (!$did(clonescan,207).seltext) { echo -a You didn't select any clones | return }
  173.   if ($me !isop %mcl.chan) { echo -a You need operator status to do this. | return }
  174.   ; ban address
  175.   ban %mcl.chan $did(clonescan,207).seltext
  176. }
  177. ;==== dialog button "warn" ====
  178. on *:DIALOG:clonescan:sclick:105:{
  179.   ; got clones selected?
  180.   if (!$did(clonescan,207).seltext) { echo -a You didn't select any clones | return }
  181.   if ($me !isop %mcl.chan) { echo -a You need operator status to do this. | return }
  182.   ; getting total number of clones to kick (%t)
  183.   var %i = 1, %t = $gettok($did(clonescan,205,1).seltext,0,32)
  184.   while (%i <= %t) {
  185.     %mcl.warn = $replace(%mcl.warning,@Nick@,$gettok($did(clonescan,205,1).seltext,%i,32),@chan@,%mcl.chan)
  186.     inc %i
  187.   }
  188. }
  189. ;==== configuring settings ====
  190. on *:DIALOG:clonescan:sclick:106:$dialog(cledit,cledit,-4)
  191. ;==== dialog initialisation ====
  192. on *:DIALOG:clonescan:init:0:{
  193.   if (%mcl.msg) { }
  194.   else { %mcl.msg = No clones allowed }
  195.   if (%mcl.warning) { }
  196.   else { %mcl.warning = notice @Nick@ Please remove your clones from @chan@ }
  197.   if (%mcl.oj) { }
  198.   else {  %mcl.oj = ew }
  199. }
  200. ;==== dialog table ====
  201. dialog Clonescan {
  202.   size -1 -1 500 270
  203.   title Clone Scanning report for $active
  204.   button "&OK",101,200 240 100 25, ok default
  205.  
  206.   text "Number of clones found :",201,10 10 130 16
  207.   text "",202,140 10 40 16
  208.  
  209.   box "Clones",203,10 35 380 195
  210.   text "Nicks",204,70 55 60 16
  211.   list 205,20 70 160 150, autovsbar autohsbar
  212.   text "Host",206, 250 55 60 16
  213.   list 207,180 70 200 150, autovsbar autohsbar
  214.  
  215.   box "Punishment",208,400 35 90 195
  216.   button "&Kick",102,410 55 70 25
  217.   button "Kick&ban",103,410 90 70 25
  218.   button "Ba&n",104,410 125 70 25
  219.   button "&Warn",105,410 160 70 25
  220.   box "",209,400 185 90 45
  221.   button "&Configure...",106, 410 198 70 25
  222. }
  223. ;==== Clonescanner punishment config table ====
  224. dialog cledit {
  225.   size -1 -1 400 315
  226.   title "Configure Punishment..."
  227.  
  228.   text You're strongly advised NOT to edit these settings unless you know what you're doing.,202,10 10 350 30
  229.   box "Kick and Kickban message", 201, 10 50 380 50
  230.   edit %mcl.msg ,1, 20 70 360 20,autohs
  231.   box "Warn message",203, 10 110 380 50
  232.   edit %mcl.warning ,2, 20 130 360 20,autohs
  233.   box "When a clone joins...",204,10 170 380 100
  234.   check "Echo",3,20 190 70 16
  235.   check "Say in chan",4,20 218 75 16
  236.   check "Show Clonescan dialog",5,20 245 130 16
  237.   box "Punishment",205,200 190 190 80
  238.   radio "Kick",6,220 210 70 16, group
  239.   radio "Ban",7,220 230 70 16
  240.   radio "Kickban",8,220 250 70 16
  241.   radio "Warn",9,290 210 70 16
  242.   radio "Do nothing",10,290 230 80 16
  243.  
  244.   button "0&K", 101, 150 280 100 25, ok default
  245. }
  246. ;==== cleanup ====
  247. on *:unload:unset %mcl.*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement