alias (!$dialog(clone.scan.dlg)) clone.scan.dlg
alias clone.scan.dlg dialog -m clone.scan.dlg clone.scan.dlg
dialog clone.scan.dlg {
  option dbu
  size -1 -1 249 85
  title Сканер клонов - %clone.scan.chan 
  list 1, 4 4 120 68
  list 4, 125 4 74 68
  button "Старт", 2, 87 70 36 11, default
  button "Отмена", 3, 126 70 36 11, cancel
  button "Инфо", 5, 202 5 43 10
  button "Отчет", 9, 202 16 43 10
  button "Предупредить", 6, 202 32 43 10
  button "Кикнуть", 7, 202 43 43 10
  button "Забанить", 8, 202 54 43 10
}
on 1:dialog:clone.scan.dlg:*:*:{
  if ($devent == sclick) {
    if ($did == 2) clone.scan
    if ($did == 1) {
      did -r $dname 4
      var %cad = $did($dname,1).seltext
      var %scn = $gettok($hget(csc,%cad),0,44)
      var %csnc 0
      while (%csnc < %scn) { inc %csnc | did -a $dname 4 $gettok($hget(csc,%cad),%csnc,44) }
      did -c $dname 4 1
    }
    if ($did == 3) unset %clone.scan.chan
    if ($did == 5) && ($did($dname,4).seltext) .uwho $did($dname,4).seltext $did($dname,4).seltext
    if ($did == 9) && ($did($dname,1).seltext) {  
      echo -a 4-Результаты сканера клонов- ! 
      if ($hget(csc)) hfree csc
      hmake csc $nick(%clone.scan.chan,0)
      var %csn 0
      while (%csn < $nick(%clone.scan.chan,0)) {
        inc %csn
        hadd csc $address($nick(%clone.scan.chan,%csn),2) $hget(csc,$address($nick(%clone.scan.chan,%csn),2)) $+ $nick(%clone.scan.chan,%csn) $+ $chr(44)
      }
      var %css 0
      while (%css < $hget(csc,0).item) {
        inc %css
        var %cad = $hget(csc,%css).item
        var %scn = $gettok($hget(csc,%cad),0,44)
        if (%scn > 1) {
          var %clo 1 
          echo -a Адрес: %cad
          if (!%csna) {
            var %csna 1
            var %csnc 0
          }
          echo -a Ники возможных клонов: $hget(csc,%cad) 
        }
        unset %clone.scan
        unset %clo
      }
    }
    if ($did == 9) && ($did($dname,1).seltext) && ($did(clone.scan.dlg,1,1) == Клоны не найдены) { echo -a Клоны не найдены }
    if ($did == 6) && ($did($dname,4).seltext) {
      var %scn $did(clone.scan.dlg,4).lines,%csnc 0
      while (%csnc < %scn) { inc %csnc | var %ckn = $iif(%ckn,%ckn $+ $chr(44)) $+ $did(clone.scan.dlg,4,%csnc) }
      .msg %ckn На канале %clone.scan.chan запрещены клоны!
    }
    if ($did == 7) && ($did($dname,4).seltext) clone.scan.kick
    if ($did == 8) && ($did($dname,4).seltext) clone.scan.ban
  }
}
alias clone.scan {
  if ($active !ischan) { set %err.w 110 | set %err.h 40 | set %err.b.x 38 | set %err.b.y 25 | set %err.msg Активное окно не канал! | error | return }
  if (!%clone.scan.chan) && ($active ischan) set %clone.scan.chan $active
  if ($active != %clone.scan.chan) && ($active ischan) set %clone.scan.chan $active
  dialog -t clone.scan.dlg Сканер клонов - %clone.scan.chan
  if ($me !isop %clone.scan.chan) { did -h clone.scan.dlg 6 | did -h clone.scan.dlg 7 | did -h clone.scan.dlg 8 }
  else { did -v clone.scan.dlg 6 | did -v clone.scan.dlg 7 | did -v clone.scan.dlg 8 }
  set %clone.scan 1
  if ($chan(%clone.scan.chan).ial == $false) { .ial on | who %clone.scan.chan | return }
  did -r clone.scan.dlg 1
  did -r clone.scan.dlg 4
  if ($hget(csc)) hfree csc
  hmake csc $nick(%clone.scan.chan,0)
  var %csn 0
  while (%csn < $nick(%clone.scan.chan,0)) {
    inc %csn
    hadd csc $address($nick(%clone.scan.chan,%csn),2) $hget(csc,$address($nick(%clone.scan.chan,%csn),2)) $+ $nick(%clone.scan.chan,%csn) $+ $chr(44)
  }
  var %css 0
  while (%css < $hget(csc,0).item) {
    inc %css
    var %cad = $hget(csc,%css).item
    var %scn = $gettok($hget(csc,%cad),0,44)
    if (%scn > 1) {
      var %clo 1 
      did -a clone.scan.dlg 1 %cad
      if (!%csna) {
        var %csna 1
        var %csnc 0
        while (%csnc < %scn) { inc %csnc | did -a clone.scan.dlg 4 $gettok($hget(csc,%cad),%csnc,44) }
      }
      did -c clone.scan.dlg 1 1
      did -c clone.scan.dlg 4 1
    }
  }
  if (!%clo) { did -a clone.scan.dlg 1 Клоны не найдены }
  if (%sound == on) splay $shortfn($mircdir) $+ sys\sounds\drums.wav
  did -c clone.scan.dlg 1 1
  unset %clone.scan
  unset %clo
}
raw 352:*: if (%clone.scan) haltdef
raw 315:*: if (%clone.scan) { clone.scan | haltdef }
alias clone.scan.kick dialog -m clone.scan.kick clone.scan.kick
dialog clone.scan.kick {
  option dbu
  size -1 -1 83 53
  title "Кикнуть"
  box "", 1, 4 2 75 32
  radio "Выделеный ник", 2, 9 10 60 10
  radio "Все ники этого хоста", 3, 9 20 63 10
  button "Кикнуть", 4, 4 38 36 11, default, ok
  button "Отмена", 5, 43 38 36 11, cancel
}
on 1:dialog:clone.scan.kick:*:*:{
  if ($devent == init) did -c $dname 2
  if ($devent == sclick) {
    if ($did == 4) {
      if ($did($dname,2).state) kick %clone.scan.chan $did(clone.scan.dlg,4).seltext На канале %clone.scan.chan запрещены клоны!
      if ($did($dname,3).state) {
        var %scn $did(clone.scan.dlg,4).lines,%csnc 0
        while (%csnc < %scn) { inc %csnc | var %ckn = $iif(%ckn,%ckn $+ $chr(44)) $+ $did(clone.scan.dlg,4,%csnc) }
        kick %clone.scan.chan %ckn На канале %clone.scan.chan запрещены клоны!
      }
    }
  }
}
alias clone.scan.ban dialog -m clone.scan.ban clone.scan.ban 
dialog clone.scan.ban {
  option dbu
  size -1 -1 83 53
  title "Забанить"
  box "", 1, 4 2 75 32
  radio "Выделеный ник", 2, 9 10 60 10
  radio "Все ники этого хоста", 3, 9 20 63 10
  button "Забанить", 4, 4 38 36 11, default, ok
  button "Отмена", 5, 43 38 36 11, cancel
}
on 1:dialog:clone.scan.ban:*:*:{
  if ($devent == init) did -c $dname 2
  if ($devent == sclick) {
    if ($did == 4) {
      if ($did($dname,2).state) { ban %clone.scan.chan $did(clone.scan.dlg,4).seltext 7 | kick %clone.scan.chan $did(clone.scan.dlg,4).seltext На канале %clone.scan.chan запрещены клоны! }
      if ($did($dname,3).state) {
        ban %clone.scan.chan $did(clone.scan.dlg,4).seltext 2
        var %scn $did(clone.scan.dlg,4).lines,%csnc 0
        while (%csnc < %scn) { inc %csnc | var %ckn = $iif(%ckn,%ckn $+ $chr(44)) $+ $did(clone.scan.dlg,4,%csnc) }
        kick %clone.scan.chan %ckn На канале %clone.scan.chan запрещены клоны!
      }
    }
  }
}