- Home»
- Cod sursa: chanctrl.tcl
chanctrl.tcl
chanctrl.tcl
TCL designed to work with eggdrop 1.5.3 or higher. This component was designed to monitor one or more channels for colour usage. If it detects somebody using colours the person will get first a warning message from the bot. After a second misdoing person will get kicked and warned again. If the pers
| Postat de | Copyright | Categorie | Review user | Vizualizari | Data |
|---|---|---|---|---|---|
| btc | johoho | protections | Cod netestat | 381 | 2023-12-24 23:31:25 |
# chanctrl.tcl for netbots.tcl v3.15
# designed to work with eggdrop 1.5.3 or higher
# Johoho's Eggdrop Page - http://johoho.tuts.net/eggdrop/
# chanctrl.tcl copyright (c) 1999,2000 by johoho <johoho@hojo-net.de>
# netbots.tcl copyright (c) 1998-2000 by slennox <slennox@egghelp.org>
## chanctrl.tcl component script v2.10.0, 22.04.2000 ##
# History:
#
# v1.00.0, 01.02.2000 - initial release
# v1.50.0, 03.02.2000 - added quit msg check
# v1.51.0, 17.03.2000 - fixed wrong bans and quit msg check procedures
# v1.52.0, 19.03.2000 - added a comment on useradd
# v2.00.0, 01.04.2000 - complete rewrite of the code
# v2.10.0, 22.04.2000 - added action and part check (/me && [/leave || /part])
# thanks to dw and NML_375 for help. thanks slennox for netbots.tcl
proc cc_check {text} {
if {regexp -- \[\003\] $text} {
return 1
} else {
return 0
}
}
proc cc_part {nick uhost hand chan text} {
global cc_chans cc_echans cc_flag
if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
if {$cc_chans != ""} {
if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
}
if {$cc_echans != ""} {
if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
}
if {[cc_check $text]} {
set cc_what "part"
cc_core $nick $uhost $hand $chan $text $cc_what
}
}
proc cc_pubm {nick uhost hand chan text} {
global cc_chans cc_echans cc_flag
if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
if {$cc_chans != ""} {
if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
}
if {$cc_echans != ""} {
if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
}
if {[cc_check $text]} {
set cc_what "pubm"
cc_core $nick $uhost $hand $chan $text $cc_what
}
}
proc cc_action {nick uhost hand chan keyword text} {
global cc_chans cc_echans cc_flag
if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
if {$cc_chans != ""} {
if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
}
if {$cc_echans != ""} {
if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
}
if {[cc_check $text]} {
set cc_what "pubm"
cc_core $nick $uhost $hand $chan $text $cc_what
}
}
proc cc_quit {nick uhost hand chan text} {
global cc_chans cc_echans cc_flag
if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
if {$cc_chans != ""} {
if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
}
if {$cc_echans != ""} {
if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
}
if {[cc_check $text]} {
set cc_what "quit"
cc_core $nick $uhost $hand $chan $text $cc_what
}
}
proc cc_core {nick uhost hand chan text cc_what} {
global cc_longban cc_note cc_shortban
global cc_txt_part1 cc_txt_part2 cc_txt_part3 cc_txt_part4
global cc_txt_pubm1 cc_txt_pubm2 cc_txt_pubm3 cc_txt_pubm4
global cc_txt_quit1 cc_txt_quit2 cc_txt_quit3 cc_txt_quit4
if {$cc_what == "part"} {
if {[getuser $hand xtra part_color] == "3"} {
# check if user is on level 3 (fourth warning - long ban)
set i 0
foreach hmask [getuser $hand hosts] {
newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_longban
incr i
}
foreach recipient $cc_note {
if {[validuser $recipient]} {
sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
}
}
unset i
foreach tmp $cc_txt_part4 {
puthelp "PRIVMSG $nick :$tmp"
}
putlog "ChanCtrl: $hand has used colour in $chan. Holding status on level 3."
return 1
} elseif {[getuser $hand xtra part_color] == "2"} {
# check if user is on level 2 (third warning - short ban)
set i 0
foreach hmask [getuser $hand hosts] {
newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_shortban
incr i
}
foreach recipient $cc_note {
if {[validuser $recipient]} {
sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
}
}
unset i
foreach tmp $cc_txt_part3 {
puthelp "PRIVMSG $nick :$tmp"
}
setuser $hand xtra part_color "3"
putlog "ChanCtrl: $hand has used colour in $chan. Raising status to level 3."
return 1
} elseif {[getuser $hand xtra part_color] == "1"} {
# check if user is on level 1 (second warning - no action)
foreach tmp $cc_txt_part2 {
puthelp "PRIVMSG $nick :$tmp"
}
setuser $hand xtra part_color "2"
putlog "ChanCtrl: $hand has used colour in $chan. Raising status to level 2."
return 1
} else {
# no record yet (first warning - no action)
if {![validuser $nick]} {
putlog "ChanCtrl: added $nick with [maskhost $uhost] for part colour"
adduser $nick [maskhost $uhost]
setuser $nick comment "Added by ChanCtrl - [ctime [unixtime]]"
}
foreach tmp $cc_txt_part1 {
puthelp "PRIVMSG $nick :$tmp"
}
setuser $nick xtra part_color "1"
putlog "ChanCtrl: $nick has used colour in $chan. Raising status to level 1."
return 1
}
} elseif {$cc_what == "pubm"} {
if {[getuser $hand xtra pubm_color] == "3"} {
# check if user is on level 3 (fourth warning - long ban)
set i 0
putkick $chan $nick "Colour Use"
foreach hmask [getuser $hand hosts] {
newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_longban
incr i
}
foreach recipient $cc_note {
if {[validuser $recipient]} {
sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
}
}
unset i
foreach tmp $cc_txt_pubm4 {
puthelp "PRIVMSG $nick :$tmp"
}
putlog "ChanCtrl: $hand has used colour in $chan. Holding status on level 3."
return 1
} elseif {[getuser $hand xtra pubm_color] == "2"} {
# check if user is on level 2 (third warning - short ban)
set i 0
putkick $chan $nick "Colour Use - banned for $cc_shortban minutes"
foreach hmask [getuser $hand hosts] {
newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_shortban
incr i
}
foreach recipient $cc_note {
if {[validuser $recipient]} {
sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
}
}
unset i
foreach tmp $cc_txt_pubm3 {
puthelp "PRIVMSG $nick :$tmp"
}
setuser $hand xtra pubm_color "3"
putlog "ChanCtrl: $hand has used colour in $chan. Raising status to level 3."
return 1
} elseif {[getuser $hand xtra pubm_color] == "1"} {
# check if user is on level 1 (second warning - kick)
foreach tmp $cc_txt_pubm2 {
puthelp "PRIVMSG $nick :$tmp"
}
putkick $chan $nick "Colour Use"
setuser $hand xtra pubm_color "2"
putlog "ChanCtrl: $hand has used colour in $chan. Raising status to level 2."
return 1
} else {
# no record yet (first warning - no action)
if {![validuser $nick]} {
putlog "ChanCtrl: added $nick with [maskhost $uhost] for public colour"
adduser $nick [maskhost $uhost]
setuser $nick comment "Added by ChanCtrl - [ctime [unixtime]]"
}
foreach tmp $cc_txt_pubm1 {
puthelp "PRIVMSG $nick :$tmp"
}
setuser $nick xtra pubm_color "1"
putlog "ChanCtrl: $nick has used colour in $chan. Raising status to level 1."
return 1
}
} elseif {$cc_what == "quit"} {
if {[getuser $hand xtra quit_color] == "3"} {
# check if user is on level 3 (fourth warning - long ban)
set i 0
foreach hmask [getuser $hand hosts] {
newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_longban
incr i
}
foreach recipient $cc_note {
if {[validuser $recipient]} {
sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
}
}
unset i
sendnote ChanCtrl $hand $cc_txt_quit4
putlog "ChanCtrl: $hand has used colour in $chan. Holding status on level 3."
return 1
} elseif {[getuser $hand xtra quit_color] == "2"} {
# check if user is on level 2 (third warning - short ban)
set i 0
foreach hmask [getuser $hand hosts] {
newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_shortban
incr i
}
foreach recipient $cc_note {
if {[validuser $recipient]} {
sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
}
}
unset i
sendnote ChanCtrl $hand $cc_txt_quit3
setuser $hand xtra quit_color "3"
putlog "ChanCtrl: $hand has used colour in $chan. Raising status to level 3."
return 1
} elseif {[getuser $hand xtra quit_color] == "1"} {
# check if user is on level 1 (second warning - no action)
sendnote ChanCtrl $hand $cc_txt_quit2
setuser $hand xtra quit_color "2"
putlog "ChanCtrl: $nick has used colour in $chan. Raising status to level 2."
return 1
} else {
# no record yet (first warning - no action)
if {![validuser $nick]} {
putlog "ChanCtrl: added $nick with [maskhost $uhost] for colour quit"
adduser $nick [maskhost $uhost]
setuser $nick comment "Added by ChanCtrl - [ctime [unixtime]]"
}
sendnote ChanCtrl $hand $cc_txt_quit1
setuser $nick xtra quit_color "1"
putlog "ChanCtrl: $nick has used colour in $chan. Raising status to level 1."
return 1
}
}
}
bind part - * cc_part
if {!$cc_part} {
unbind part - * cc_part
}
bind pubm - * cc_pubm
bind ctcp - ACTION cc_action
if {!$cc_pubm} {
unbind pubm - * cc_pubm
unbind ctcp - ACTION cc_action
}
bind sign - * cc_quit
if {!$cc_quit} {
unbind sign - * cc_quit
}
IRC Snippets