## Direct Chat ## by Sniper (kindred@infinex.com) with help from various sources. ## ban script borrowed from facelift.tcl (by quest) and modified. ## die script written by zen, modified by Sniper ### Note: Must load after combot.tcl and/or facelift.tcl ## in order for it to take effect. ########## Do not go past this point ######### set NC "\002\[\037Direct Chat\037\002\]\002" ## deop bind pub o ${CC}deop pub_deop proc pub_deop {nick uhost hand channel rest} { global CC NC if {[onchan $rest $channel]==1} { putserv "MODE $channel -o $rest" } if {$rest==""} { global CC NC putserv "NOTICE $nick :$NC Use: ${CC}deop ";return 0 } if {[onchan $rest $channel]==0} { global CC NC putserv "NOTICE $nick :$NC $rest is not on the $channel.";return 0 } if {[isop $rest $channel]==0} { global CC NC putserv "NOTICE $nick :$NC $rest is already deopped." } } ## op bind pub o ${CC}op pub_op proc pub_op {nick uhost hand channel rest} { global CC NC if {[onchan $rest $channel]==1} { putserv "MODE $channel +o $rest" } if {$rest==""} { putserv "NOTICE $nick :$NC Use: ${CC}op ";return 0 } if {[isop $rest $channel]==1} { putserv "NOTICE $nick :$NC $rest is already opped." } if {[onchan $rest $channel]==0} { putserv "NOTICE $nick :$NC $rest is not on $channel." } } ## down bind pub o down pub_down bind pub o ${CC}down pub_down proc pub_down {nick uhost hand channel rest} { global CC NC putserv "MODE $channel -o $nick" } ## up bind pub o up pub_up bind pub o ${CC} pub_up proc pub_up {nick uhost hand channel rest} { global CC putserv "MODE $channel +o $nick" } ## kick start bind pub o ${CC}k pub_kick bind pub o ${CC}kick pub_kick proc pub_kick {nick uhost hand channel rest} { global CC NC kick set who [lindex $rest 0] set reason [lrange $rest 1 end] if {$who==""} { putserv "NOTICE $nick :$NC Use: ${CC}kick ";return 0 } if {[onchan $who $channel]==0} { putserv "NOTICE $nick :$NC $rest is not on $channel." } if {$reason == ""} {set reason "requested"} putserv "KICK $channel $who :\002${reason}\002" } ## ping bind pub p ${CC}ping pub_ping bind pub p ping pub_ping proc pub_ping {nick uhost hand channel rest} { global CC NC putserv "PRIVMSG $channel :$nick, \002PONG\002"} ## pong bind pub p ${CC}pong pub_pong bind pub p pong pub_pong proc pub_pong {nick uhost hand channel rest} { putserv "PRIVMSG $channel :$nick, \002PING\002"} ## adduser bind pub m ${CC}adduser pub_adduser proc pub_adduser {nick uhost hand channel rest} { global CC NC if {[validuser $rest]==1} {putserv "NOTICE $nick :$NC $rest is already in my userlist.";return 0 } if {[onchan $rest $channel]==1} { set who [lindex $rest 0] set hostmask [lindex $rest 1] adduser $who $hostmask set host [maskhost [getchanhost $rest $channel]] addhost $who $host save set flags [chattr who] putserv "NOTICE $nick :$NC $who \002\[\002$host\002\]\002 has been added to the userlist.";return 0 putserv "NOTICE $nick :$NC Flags for $rest1 are \002\]\002${flags}\002\]\002" } if {$rest==""} { putserv "NOTICE $nick :$NC Use: ${CC}adduser ";return 0 } if {[onchan $rest $channel]==0} { putserv "NOTICE $nick :$NC That user is not on $channel." } } ## +user bind pub m ${CC}+user pub_+user proc pub_+user {nick uhost hand channel rest} { global CC NC set who [lindex $rest 0] set hostmask [lindex $rest 1] if {($who=="") || ($hostmask=="")} { putserv "NOTICE $nick :$NC Use: ${CC}+user ";return 0 } set who [lindex $rest 0] set hostmask [lindex $rest 1] if {[validuser $who]==0} { adduser $who $hostmask save putserv "NOTICE $nick :$NC $who has been added to userlist.";return 0 } if {[validuser $who]==1} { putserv "NOTICE $nick :$NC $who is already in my userlist.";return 0 } } ## +bot bind pub m ${CC}+bot pub_+bot proc pub_+bot {nick uhost hand channel rest} { global CC NC set bot [lindex $rest 0] set address [lindex $rest 1] if {[validuser $bot]==1} { putserv "NOTICE $nick :$NC $bot is already in my userlist.";return 0 } if {($bot=="") || ($address=="")} { putserv "NOTICE $nick :$NC Use: ${CC}+bot ";return 0 } if {[validuser $bot]==0} { addbot $bot $address save putserv "NOTICE $nick :$NC $bot \002\[\002${rest2}\002\]\002 has been add to userlist as a bot.";return 0 } } ## chattr bind pub m ${CC}chattr pub_chattr proc pub_chattr {nick uhost hand channel rest} { global ownern flagss lowerflag nflagl CC NC set ownern [lindex $rest 0] set flagss [lindex $rest 1] if {$ownern==""} { putserv "NOTICE $nick :$NC Use: ${CC}chattr ";return 0 } if {[validuser $ownern]==0} {putserv "NOTICE $nick :$NC No such user!";return 0 } if {$flagss==""} { putserv "NOTICE $nick :$NC Use: ${CC}chattr ";return 0 } if {([matchattr $ownern n] == 1) && ([matchattr $nick n] == 0)} { putserv "NOTICE $nick :$NC You do not have access to change ${ownern}'s flags." } if {[matchattr $nick n] == 1} { chattr $ownern $flagss set flags [chattr $ownern] putserv "NOTICE $nick :$NC Chattr $ownern \002\[\002${flagss}\002\]\002" putserv "NOTICE $nick :$NC Flags for $ownern are now \002\[\002${flags}\002\]\002" save } ##stop them from adding/removing +n if their not a owner. if {[matchattr $nick n] == 0} { set lowerflag [string tolower $flagss] set nflagl [string trim $flagss abcdefghijklmopqrstuvwxyz+-] if {$nflagl != ""} {putserv "NOTICE $nick :$NC You do not have access to add or remove the flag \002'\002n\002'\002 from that user.";return 1} } ##stops other users from giving others +m. if {([matchattr $nick n] == 0) && ([matchattr $nick m] == 1) && ([matchattr $ownern m] == 1)} { set lowerflag [string tolower $flagss] set nflagl [string trim $flagss abcdefghijklnopqrstuvwxyz+-] if {$nflagl != ""} { putserv "NOTICE $nick :$NC You do not have access to add or remove the flag \002'\002m\002'\002 from $ownern.";return 0 } } if {([matchattr $nick n] == 0) && ([matchattr $ownern n] == 0)} { chattr $ownern $flagss set flags [chattr $ownern] putserv "NOTICE $nick :$NC Chattr $ownern \002\[\002${flagss}\002\]\002" putserv "NOTICE $nick :$NC Flags for $ownern are now \002\[\002${flags}\002\]\002" save } } ## me bind pub o ${CC}me pub_me proc pub_me {nick uhost hand channel rest} { putserv "PRIVMSG $channel :\001ACTION $rest\001" } ## msg bind pub o ${CC}msg pub_msg proc pub_msg {nick uhost hand channel rest} { global CC NC if {$rest==""} { putserv "NOTICE $nick :$NC Use: ${CC}msg ";return 0 } set person [lindex $rest 0] set rest [lrange $rest 1 end] putserv "PRIVMSG $person :$rest" } ## save bind pub m ${CC}save pub_save proc pub_save {nick uhost hand channel rest} { global CC NC save putserv "NOTICE $nick :$NC User file has been saved." } ## ban bind pub m ${CC}ban pub_ban bind pub m ${CC}b pub_ban bind pub m ${CC}fuck pub_ban proc pub_ban {nick uhost hand channel rest} { global CC NC global botnick if {$rest == ""} { putserv "NOTICE $nick :$NC Use: ${CC}ban (b or fuck) \[reason\]" return 0 } if {$rest!=""} { set handle [lindex $rest 0] set reason [lrange $rest 1 end] append userhost $handle "!" [getchanhost $handle $channel] set hostmask [maskhost $userhost] if {![onchan $handle $channel]} { putserv "NOTICE $nick :$NC $handle is not on $channel." return 0 } if {[onchansplit $handle $channel]} { putserv "NOTICE $nick :$NC $handle is currently net-split." return 0 } if {$handle == $botnick} { putserv "KICK $channel $nick :$NC You really shouldn't try that..." return 0 } if {$reason == ""} { set reason "\002requested\002" } newban $hostmask $nick "$reason" 0 return 1 } } ## say bind pub o ${CC}say pub_say proc pub_say {nick uhost hand channel rest} { set who [lrange $rest 0 end] putserv "PRIVMSG $channel :$who " } ## help bind dcc p directhelp dcc_directhelp proc dcc_directhelp {hand idx args} { global botnick global CC NC set args [lindex $args 0] if {$args==""} { putdcc $idx "$NC Command Character for $botnick is \002\[\002${CC}\002\]\002" putdcc $idx "$NC \002\[\002 Cmds with * can do it without the Command Character \002\]\002" putdcc $idx "$NC \002PUBLIC COMMANDS\002" putdcc $idx "$NC" putdcc $idx "$NC \002\037All users\037:\002" putdcc $idx "$NC ping pong" putdcc $idx "$NC" putdcc $idx "$NC \002\037For ops only\037:\002" putdcc $idx "$NC say msg op up" putdcc $idx "$NC me kick deop down" putdcc $idx "$NC" putdcc $idx "$NC \002\037For Masters only\037:\002" putdcc $idx "$NC chnick adduser reload" putdcc $idx "$NC chpass +user +ignore" putdcc $idx "$NC chattr +bot ignores" putdcc $idx "$NC comment +host jump" putdcc $idx "$NC chemail save ban" putdcc $idx "$NC chinfo" putdcc $idx "$NC" putdcc $idx "$NC \002\037For Bot Owners only\037:\002" putdcc $idx "$NC botnick die" putdcc $idx "$NC ^--- Available in dcc also." putdcc $idx "$NC" putdcc $idx "$NC \002\[\002 Any commands starting with \002'\002+\002'\002 may be preceded by \002'\002-\002'\002 instead.\002\]\002" } if {$args!=""} { putserv $idx "$NC Use: .Directhelp" } } ## -bot bind pub m ${CC}-bot pub_-bot proc pub_-bot {nick chan uhost hand rest} { global CC NC set bot [lindex $rest 0] if {$bot==""} { putserv "NOTICE $nick :$NC Use: ${CC}-bot ";return 0 } if {[validuser $bot] == 0} { putserv "NOTICE $nick :$NC $bot is not on my userlist.";return 0 } if {[matchattr $bot b] == 0} { putserv "NOTICE $nick :$NC $bot is not a bot on the userlist.";return 0 } if {[matchattr $bot b] == 1} { deluser $bot save putserv "NOTICE $nick :$NC $bot has been deleted from the userlist." } } ## -user start bind pub m ${CC}-user pub_-user proc pub_-user {nick chan uhost hand rest} { global CC NC set who [lindex $rest 0] if {$who == ""} { putserv "NOTICE $nick :$NC Use: ${CC}-user " } else { if {[validuser $who] == 0} { putserv "NOTICE $nick :$NC $who is not on my userlist." } else { if {[matchattr $who n] == 1} { putserv "NOTICE $nick :$NC You cannot delete a bot owner." } else { if {([matchattr $who m] == 1) && ([matchattr $nick n] == 0)} { putserv "NOTICE $nick :$NC You don't have access to delete $who." } else { deluser $who save putserv "NOTICE $nick :$NC $who has been deleted." } } } } } ## chpass bind pub m ${CC}chpass pub_chpass proc pub_chpass {nick chan uhost hand rest} { global CC NC putserv "NOTICE $nick :$NC Can only be changed in a dcc chat." } ## +host ### Hosts we dont want set thehosts { *!*@* *!* *!@* !*@* *!*@*.* *!@*.* !*@*.* *@*.* *!*@*.com *!*@*com *!*@*.net *!*@*net *!*@*.org *!*@*org *!*@*.gov *!*@*gov *!*@*.ca *!*@*ca *!*@*.uk *!*@*uk *!*@*.mil *!*@*mil *!*@*.fr *!*@*fr *!*@*.au *!*@*au *!*@*.nl *!*@*nl *!*@*edu *!*@*.edu *!*@*se *!*@*.se *!*@*.nz *!*@*nz *!*@*.eg *!*@*eg *!*@*dk *!*@*.dk *!*@*.il *!*@*il *!*@*.no *!*@*no *!*@*br *!*@*.br *!*@*.gi *!*@*gi } bind pub m ${CC}+host pub_+host global thehosts proc pub_+host {nick chan uhost hand rest} { global CC thehosts NC set who [lindex $rest 0] set hostname [lindex $rest 1] set badhost 0 foreach * [gethosts $who] { if {${hostname} == ${*}} { putserv "NOTICE $nick :$NC That hostmask is already there.";return 0 } } if {($who == "") && ($hostname == "")} { putserv "NOTICE $nick :$NC Use: ${CC}+host ";return 0 } if {[validuser $who]==0} { putserv "NOTICE $nick :$NC No such user.";return 0 } if {([matchattr $nick n] == 0) && ([matchattr $who n] == 1)} { putserv "NOTICE $nick :$NC Can't add hostmasks to the bot owner.";return 0 } foreach * $thehosts { if {${hostname} == ${*}} { putserv "NOTICE $nick :$NC Invalid hostmask!" set badhost 1 } } if {$badhost != 1} { addhost $who $hostname putserv "NOTICE $nick :$NC Added \002\[\002${hostname}\002\]\002 to $who." } } ## -host bind pub m ${CC}-host pub_-host proc pub_-host {nick uhost hand chan rest} { global CC thehosts NC set who [lindex $rest 0] set hostname [lindex $rest 1] set completed 0 if {($who == "") || ($hostname == "")} { putserv "NOTICE $nick :$NC Use: ${CC}-host " return 0 } if {[validuser $who]==0} { putserv "NOTICE $nick :$NC No such user." return 0 } if {([matchattr $nick n] == 0) && ([matchattr $who n] == 1)} { putserv "NOTICE $nick :$NC Can't add hostmasks to the bot owner." return 0 } foreach * [gethosts $who] { if {${hostname} == ${*}} { delhost $who $hostname save putserv "NOTICE $nick :$NC Removed \002\[\002${hostname}\002\]\002 from $who." ### Make it do the -host thing here, and any message that goes along with it set completed 1 } } if {$completed == 0} { putserv "NOTICE $nick :No such hostmask!" } } ## chemail bind pub m ${CC}chemail pub_chemail proc pub_chemail {nick uhost hand chan rest} { global CC NC set who [lindex $rest 0] set email [lindex $rest 1] if {($who == "") || ($email == "")} { putserv "NOTICE $nick :$NC Use: ${CC}chemail " return 0 } if {[validuser $who]==0} { putserv "NOTICE $nick :$NC No such user." return 0 } if {[validuser $who]==1} { setemail $who $email putserv "NOTICE $nick :$NC Added email address \002\[\002${email}\002\]\002 to $who." } } ##chinfo bind pub m ${CC}chinfo pub_chinfo proc pub_chinfo {nick uhost hand chan rest} { global CC NC set who [lindex $rest 0] set info [lrange $rest 1 end] if {($who == "") || ($info == "")} { putserv "NOTICE $nick :$NC Use: ${CC}chinfo " return 0 } if {[validuser $who]==0} { putserv "NOTICE $nick :$NC No such user." return 0 } if {[validuser $who]==1} { setinfo $who $info putserv "NOTICE $nick :$NC Added info \002\[\002${info}\002\]\002 to $who." } } ## chnick bind pub m ${CC}chnick pub_chnick proc pub_chnick {nick uhost hand chan rest} { global CC NC owner set old [lindex $rest 0] set new [lindex $rest 1] if {($old == "") || ($new == "")} { putserv "NOTICE $nick :$NC Use: ${CC}chnick " return 0 } if {[validuser $old]==0} { putserv "NOTICE $nick :$NC No such user." return 0 } if {([matchattr $old n] == 1)} { putserv "NOTICE $nick :$NC cannot change the bot owner's nick";return 0 } if {[validuser $old]==1} { chnick $old $new putserv "NOTICE $nick :$NC Changed partyline nick from \002\[\002${old}\002\]\002 to \002\[\002${new}\002\]\002" } } ## comment bind pub m ${CC}comment pub_comment proc pub_comment {nick uhost hand chan rest} { global CC NC set who [lindex $rest 0] set comment [lrange $rest 1 end] if {($who == "") || ($comment == "")} { putserv "NOTICE $nick :$NC Use: ${CC}chinfo " return 0 } if {[validuser $who]==0} { putserv "NOTICE $nick :$NC No such user." return 0 } if {[validuser $who]==1} { setcomment $who $comment putserv "NOTICE $nick :$NC Added info \002\[\002${comment}\002\]\002 to $who." } } ## +ignore bind pub m ${CC}+ignore pub_+ignore proc pub_+ignore {nick uhost hand chan rest} { global CC NC set hostmask [lindex $rest 0] set creater $nick set comment [lindex $rest 1] set lifetime 0 if {$hostmask == ""} { putserv "NOTICE $nick :$NC Use: ${CC}+ignore \[comment\]" return 0 } if {[isignore $hostmask] == 1} { putserv "NOTICE $nick :$NC $hostmask is alreay set on ignore.";return 0 } if {[isignore $hostmask] == 0} { newignore $hostmask $creater $comment $lifetime putserv "NOTICE $nick :$NC Now ignoring \002\[\002${hostmask}002\]\002" save } } ## -ignore bind pub m ${CC}-ignore pub_-ignore proc pub_-ignore {nick uhost hand chan rest} { global CC NC set hostmask [lindex $rest 0] if {$hostmask == ""} { putserv "NOTICE $nick :$NC Use: ${CC}-ignore " return 0 } if {[isignore $hostmask] == 0} { putserv "NOTICE $nick :$NC $hostmask is not on my ignore list.";return 0 } if {[isignore $hostmask] == 1} { killignore $hostmask putserv "NOTICE $nick :$NC No longer ignoring \002\[\002${hostmask}002\]\002" save } } ## ignores bind pub m ${CC}ignores pub_ignores proc pub_ignores {nick uhost hand chan rest} { global CC NC putserv "NOTICE $nick :$NC Ignore list is only available in dcc chat." } ## reload bind pub m ${CC}reload pub_reload proc pub_reload {nick uhost hand chan rest} { global CC NC reload putcmdlog "Reloading user file..." putserv "NOTICE $nick :$NC Reloading user file..." } ## die bind pub n ${CC}die pub_die proc pub_die {nick uhost hand channel rest} { global botnick set idx [hand2idx $nick] if {$rest == ""} { set rest "Requested" } save putserv "QUIT :\002$rest\002" utimer 2 {die} } ## jump bind pub m ${CC}jump pub_jump proc pub_jump {nick uhost hand chan rest} { global CC NC set server [lindex $rest 0] set port [lindex $rest 1] set password [lindex $rest 2] jump $server $port $password } ## botnick in dcc bind dcc n botnick dcc_botnick proc dcc_botnick {nick idx rest} { set bot [lindex $rest 0] if {$bot==""} { putserv "NOTICE $nick :$NC .botnick ." return 0 } putserv "NICK $bot" } ## botnick bind pub n ${CC}botnick pub_botnick proc pub_botnick {nick uhost hand chan rest} { global CC NC set bot [lindex $rest 0] if {$bot==""} { putserv "NOTICE $nick :$NC ${CC}botnick ." return 0 } putserv "NICK $bot" } ## End putlog "\002\[\037Direct Chat\037\002\]\002 by Sniper loaded"