[script]
n0=alias gt {
n1=  if ($group(#themes) == on) {
n2=    if ($isalias(nn.tgt)) { return $nn.tgt($1-) }
n3=    else { return $1- $+  }
n4=  }
n5=  else { return $1- $+  }
n6=}
n7=
n8=alias sd {
n9=  if ($1 != $null) {
n10=    if ($group(#themes) == on) {
n11=      if ($isalias(nn.tsd)) { return $nn.tsd($1-) }
n12=      else {
n13=        if ($hget(kte_theme,parentext)) && ($eval($ifmatch,2) == $ifmatch) {
n14=          if ($hget(kte_theme,basecolors)) {
n15=            var %t = $1-
n16=            tokenize 44 $ifmatch
n17=            return $replace($remove($hget(kte_theme,parentext),<pre>),<c1>,$1,<c2>,$2,<c3>,$3,<c4>,$4,<text>, $+ %t)
n18=          }
n19=          else { return $replace($remove($hget(kte_theme,parentext),<pre>),<text>, $+ $1-) }
n20=        }
n21=        else { return $nbr($1-) }
n22=      }
n23=    }
n24=    else { return $1- }
n25=  }
n26=}
n27=
n28=alias kte_dlg {
n29=  if ($dialog($2)) { dialog -v $2 }
n30=  else { dialog $1-2 $2 }
n31=}
n32=
n33=dialog errdialog {
n34=  title "Ошибочка выходит!"
n35=  size -1 -1 153 61
n36=  option dbu
n37=  button "&Ok",4,111 47 40 12,ok
n38=  edit "",2,20 2 131 43,read multi return vsbar
n39=}
n40=on *:dialog:errdialog:*:*:{
n41=  if ($devent == init) {
n42=    did -ra $dname 2 %geninp.text
n43=    unset %geninp.text
n44=  }
n45=}
n46=
n47=alias errdialog {
n48=  set %geninp.text Ошибка: $1-
n49=  .echo -q $dialog(errdialog,errdialog,-4)
n50=}
n51=
n52=dialog eddialog {
n53=  title "Ввод инфы и т.д."
n54=  size -1 -1 153 73
n55=  option dbu
n56=  edit "",3,1 46 150 11,result autohs
n57=  button "&Ok",4,111 59 40 12,ok
n58=  button "&Cancel",5,68 59 40 12
n59=  edit "",2,20 2 131 43,read multi vsbar return
n60=}
n61=on *:dialog:e?dialog:*:*:{
n62=  if ($devent == init) {
n63=    did -a $dname 2 %geninp.text
n64=    did -a $dname 3 %geninp.ed
n65=    if (%geninp.bnc) { did -h $dname 5 }
n66=    unset %geninp.*
n67=  }
n68=  elseif ($devent == sclick) && ($did == 5) {
n69=    did -r $dname 3
n70=    dialog -k $dname
n71=  }
n72=}
n73=
n74=alias c.add {
n75=  var %x
n76=  if (! !isin $1) && (@ !isin $1) { %x = $1 $+ !*@* }
n77=  elseif (! isin $1) && (@ !isin $1) { %x = $1 $+ @* }
n78=  elseif (! !isin $1) && (@ isin $1) { %x = *! $+ $1 }
n79=  else { %x = $1 }
n80=  return $remove(%x,$chr(32),$chr(44))
n81=}
n82=alias eddialog {
n83=  set %geninp.text $1
n84=  set %geninp.ed $2
n85=  if ($prop == nc) { set %geninp.bnc 1 }
n86=  return $dialog(eddialog,eddialog,-4)
n87=}
n88=alias bkacs {
n89=  var %b = 0,%i = $chan(0)
n90=  while (%i) {
n91=    var %k = $nick($chan(%i),0)
n92=    while (%k) {
n93=      if ($me isop $chan(%i)) && ($hmatch(black,$address($nick($chan(%i),%k),5))) {
n94=        .timer 1 %b black.punish $chan(%i) $nick($chan(%i),%k) $ifmatch
n95=        inc %b
n96=      }
n97=      dec %k
n98=    }
n99=    dec %i
n100=  }
n101=}
n102=alias black.kick.all {
n103=  var %i = 1
n104=  while (%i <= $nick($1,0)) {
n105=    if ($hmatch(black,$address($nick($1,%i),5))) { .timer 1 %i black.punish $1 $nick($1,%i) $ifmatch }
n106=    inc %i
n107=  }
n108=}
n109=alias black.kick { if ($hmatch(black,$address($2,5))) { black.punish $1-2 $ifmatch } }
n110=alias black.punish {
n111=  if ($2 ison $1) {
n112=    .raw mode $1 -o+b $+($2-3,$crlf,kick $1-2 :,$iif($hget(black,$3) != n/a,$ifmatch $+ $chr(44) blacklisted,Blacklisted)) $kc
n113=    inc %black.kicked
n114=    if ($dialog(black.dialog)) { did -ra $ifmatch 8 %black.kicked }
n115=  }
n116=}
n117=alias black {
n118=  if (!$1) {
n119=    kte_dlg -m black.dialog
n120=    return
n121=  }
n122=  if ($1 == -a) {
n123=    if ($2 != $null) {
n124=      hadd -m black $2 $iif($3-,$3-,n/a)
n125=      kte_echo -a $sd($2) добавлен в игнор лист и в Черный список :).
n126=      if ($dialog(black.dialog)) { did -a $ifmatch 5 $2 $iif($3-,$nbr($3-)) }
n127=      scon -at1 bkacs
n128=      ignore $address($snick(#,1),%ban.mask) 
n129=    }
n130=    else { kte_error -a unknown user. Подождите пожалусто. }
n131=  }
n132=  elseif ($1 == -c) {
n133=    hdel -w black *
n134=    kte_echo -a $gt(The) Черный список полностью отчищен.
n135=    if ($dialog(black.dialog)) { did -r $ifmatch 5 }
n136=  }
n137=  elseif ($1 == -d) {
n138=    ignore -r $address($snick(#,1),%ban.mask)
n139=    var %i = 1,%s
n140=    while ($hmatch(black,$2,%i)) {
n141=      hdel black $hmatch(black,$2,%i)
n142=      if ($dialog(black.dialog)) {
n143=        var %x = $did($ifmatch,5).lines
n144=        while (%x) {
n145=          if ($did(black.dialog,5,%x) iswm $2) { did -d black.dialog 5 %x }
n146=          dec %x
n147=        }
n148=        if (!$did(black.dialog,5).sel) { did -b black.dialog 7 }
n149=      }
n150=      inc %s
n151=      inc %i
n152=    }
n153=    if (%s) { kte_echo -a $sd(%s) $iif(%s == 1,entry has,entries have) been successfully removed from your blacklist. }
n154=    else { kte_error -a $sd($2) is not on your blacklist. }
n155=  }
n156=  hsave -ob black DataBase\black.tbl
n157=}
n158=
n159=dialog black.add {
n160=  size -1 -1 117 45
n161=  option dbu
n162=  title Edit blacklist
n163=  text "Адрес",1,3 4 30 8
n164=  text "Причина",2,3 15 30 8
n165=  edit "",3,35 2 80 11,autohs limit 100
n166=  edit "",4,35 13 80 11,autohs limit 50
n167=  box "",5,-5 24 125 4
n168=  button "&Ok",6,75 31 40 12,ok
n169=  button "&Cancel",7,33 31 40 12,cancel
n170=}
n171=dialog black.dialog {
n172=  size -1 -1 186 97
n173=  option dbu
n174=  title Blacklist [/black]
n175=  button "&Добавить",1,143 3 40 12
n176=  button "&Изменить",7,143 19 40 12,disabled
n177=  button "&Удалить",2,143 35 40 12,disabled
n178=  button "&Очистить",6,143 47 40 12
n179=  button "&Ok",3,143 82 40 12,ok
n180=  box "",4,-5 74 196 4
n181=  list 5,2 2 137 72,size vsbar hsbar sort
n182=  edit "0",8,2 83 20 11,center read
n183=  text "выкинуто челов",9,25 85 60 9
n184=}
n185=
n186=on ^*:join:#:{
n187=  if ($nick != $me) || ($me ishop $chan) {
n188=    if ($me isop $chan) {
n189=      black.kick $chan $nick
n190=    }
n191=  }
n192=}
n193=
n194=on *:dialog:black.add:*:*:{
n195=  if ($devent == init) {
n196=    unset %black.addy %black.comm
n197=    if (%black.edit) {
n198=      did -a $dname 3 $gettok($did(black.dialog,5).seltext,1,32)
n199=      did -a $dname 4 $iif($hget(black,$gettok($did(black.dialog,5).seltext,1,32)) != n/a,$ifmatch)
n200=    }
n201=  }
n202=  elseif ($devent == sclick) {
n203=    if ($did == 6) {
n204=      if (!$did(3)) { errdialog you did not enter an address! }
n205=      else {
n206=        set %black.addy $c.add($did(3))
n207=        set %black.comm $iif($did(4),$did(4),n/a)
n208=      }
n209=    }
n210=  }
n211=}
n212=on *:dialog:black.dialog:*:*:{
n213=  if ($devent == init) {
n214=    var %i = $hget(black,0).item
n215=    while (%i) {
n216=      did -a $dname 5 $hget(black,%i).item $iif($hget(black,%i).data != n/a,$nbr($ifmatch))
n217=      dec %i
n218=    }
n219=    did -z $dname 5
n220=    if (%black.kicked isnum) { did -ra $dname 8 %black.kicked }
n221=  }
n222=  elseif ($devent == sclick) {
n223=    if ($did == 1) {
n224=      .echo -q $dialog(black.add,black.add,-4)
n225=      if (%black.addy) && (%black.comm) {
n226=        if (%black.addy == *!*@*) { errdialog Не верная маска, слишком много народу подходит! }
n227=        elseif (%black.addy iswm $address($me,5)) { errdialog Вы не можете добавить себя в черный список! }
n228=        else {
n229=          did -a $dname 5 %black.addy $iif(%black.comm != n/a,$nbr(%black.comm))
n230=          hadd -m black %black.addy %black.comm
n231=          hsave -ob black DataBase\black.tbl
n232=          scon -at1 bkacs
n233=        }
n234=        unset %black.addy %black.comm
n235=      }
n236=    }
n237=    elseif ($did == 2) {
n238=      if ($did(5).sel) {
n239=        hdel black $did(5).seltext
n240=        did -d $dname 5 $did(5).sel
n241=        hsave -ob black DataBase\black.tbl
n242=        did -b $dname 7,2
n243=      }
n244=    }
n245=    elseif ($did == 5) { did $iif($did($did).sel,-e,-b) $dname 7,2 }
n246=    elseif ($did == 7) {
n247=      if ($did(5).sel) {
n248=        set %black.edit 1
n249=        .echo -q $dialog(black.add,black.add,-4)
n250=        if (%black.addy) && (%black.comm) {
n251=          hdel black $did(5).seltext
n252=          hadd -m black %black.addy %black.comm
n253=          did -oc $dname 5 $did(5).sel %black.addy $iif(%black.comm != n/a,$nbr($ifmatch))
n254=          hsave -ob black DataBase\black.tbl
n255=          scon -at1 bkacs
n256=        }
n257=        unset %black.edit %black.comm %black.addy
n258=      }
n259=    }
n260=    elseif ($did == 6) {
n261=      did -r $dname 5
n262=      hdel -w black *
n263=      hsave -ob black DataBase\black.tbl
n264=      did -b $dname 7,2
n265=    }
n266=  }
n267=}
n268=
n269=on *:nick:{
n270=  if ($hfind(black,$address($newnick,5),0,W)) {
n271=    var %c = $comchan($newnick,0)
n272=    while (%c) {
n273=      if ($me isop $chan) { black.kick $comchan($newnick,%c) $newnick }
n274=      dec %c
n275=    }
n276=  }
n277=}
n278=on *:op:#:{ if ($opnick == $me) { black.kick.all $chan } }
n279=
n280=on *:start: {
n281=  if (!%ban.mask) { set %ban.mask 2 }
n282=}
