;a code by l4roxyl
;24/07/2009 
;-
;start code
alias -l qt returnex $+($chr(2),$1-,$chr(2))
alias infochan {
  var %_ec = echo -aceq info $str($chr(149),3) /infochan:
  if ($1) { 
    if ($hget($1,_delay)) { %_ec Same channel( $+ $1 $+ ) pls $hget($1,_delay).unset seconds waiting. | returnex }
    if ($1 !ischan) { %_ec $1 no such channel. | returnex }
  }
  else { %_ec insufficient parameters. /infochan <#channel> | returnex }
  hinc -mu10 $1 _delay 1 | .enable #_chan_info | who $1
}
#_chan_info off
raw *:*: {
  haltdef | tokenize 32 $rawmsg 
  if ($2 = 352) {
    hinc -m $+(stats_,$4) _all_user 1 | hinc -m $+(stats_,$4) $+(server_,$7) 1
    if ($7 = $server) hinc -m $+(stats_,$4) _server 1
    hadd -m $+(stats_,$4) $6 $addtok($hget($+(stats_,$4),$6),$8,63)
    if ($regex($9,\*)) { 
      hinc -m $+(stats_,$4) _irc_op 1
      hadd -m $+(stats_,$4) _ircop_nick $addtok($hget($+(stats_,$4),_ircop_nick),$8,44)
    }
    if ($regex($9,G)) { 
      hinc -m $+(stats_,$4) _away 1 
      hadd -m $+(stats_,$4) _away_nick $addtok($hget($+(stats_,$4),_away_nick),$8,44)
    }
    if ($regex(prefix,$9,(@|&|%|\+|~))) { 
      hinc -m $+(stats_,$4) _prefixes 1 
      hadd -m $+(stats_,$4) _prefixes_nick $addtok($hget($+(stats_,$4),_prefixes_nick),$+($regml(prefix,1),$8),44)
    }
    if ($regex($9,B)) { 
      hinc -m $+(stats_,$4) _bot 1 
      hadd -m $+(stats_,$4) _bot_nick $addtok($hget($+(stats_,$4),_bot_nick),$8,44)
    }
    if ($regex($9,H)) hinc -m $+(stats_,$4) _here 1
    if ($regex($9,r)) hinc -m $+(stats_,$4) _reg_nick 1
  }
  if ($2 = 315) {
    echo -c info $4 $str($chr(175),30) $4 Kanali Bilgileri Başlangiç $str($chr(175),30)
    var %_str = echo -c info $4 $str($chr(149),3) 
    %_str Toplam Kullanici: $//qt($hget($+(stats_,$4),_all_user))
    if ($hget($+(stats_,$4),_reg_nick)) { 
      %_str Kayitli Kullanici: $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41)))
    }
    if ($hget($+(stats_,$4),_away)) {
      %_str Meşgul Kullanicilar: $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41))) - $&
        $regsubex($hget($+(stats_,$4),_away_nick),/( $+ $chr(44) $+ )/g,$+(\1,$chr(32)))
    }
    if ($hget($+(stats_,$4),_here)) {
      %_str Çevrimiçi Kullanici: $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41)))
    }
    if ($hget($+(stats_,$4),_prefixes)) {
      %_str Ayricalikli Kullanici: $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41)))
      %_str Ayricalikli Nickler: $//qt($regsubex($regsubex($hget($+(stats_,$4),_prefixes_nick),/ $+ $chr(44) $+ /g,$chr(32)),/([@&%+~])/g,$+($chr(40),\1,$chr(41))))
    }
    if ($hget($+(stats_,$4),_bot)) {
      %_str Botlar: $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41))) - $regsubex($hget($+(stats_,$4),_bot_nick),/( $+ $chr(44) $+ )/g,$+(\1,$chr(32)))
    }
    var %_sttl = $calc($hget($+(stats_,$4),_server) *100/ $hget($+(stats_,$4),_all_user))
    %_str Bağli Sunucu: $//qt($server) - Userler: $//qt($hget($+(stats_,$4),_server)) $+($chr(40),%,$left(%_sttl,4),$chr(41)))
    if ($hget($+(stats_,$4),_irc_op)) {
      %_str Admin: $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41))) - $&
        $regsubex($hget($+(stats_,$4),_ircop_nick),/( $+ $chr(44) $+ )/g,$+(\1,$chr(32)))
    }
    if ($hfind($+(stats_,$4),\?,0,r).data) {
      %_str Toplam Klone: $//qt($v1 $+($chr(40),%,$left($calc($v1 *100/ $hget($+(stats_,$4),_all_user)),4),$chr(41)))
    }
    var %1 = 1,%_clonnick
    while ($hfind($+(stats_,$4),\?,%1,r).data) {
      %_clonnick = $regsubex($hget($+(stats_,$4),$v1),/(\?)/g,$chr(32) - $+ $chr(32))
      %_str Adres: $//qt($v1) - $+(Nickler,$chr(40),$numtok(%_clonnick,45),$chr(41),:) $//qt(%_clonnick)
      inc %1
    }
    echo -c info $4 $str(_,30) $4 Kanali Bilgileri Son $str(_,30)
    hfree $+(stats_,$4) | .disable #_chan_info
  }
}
#_chan_info end
;end code
