Code: Select all
# /* Configuration
# * In seconds, If the last time they spammed was 20 seconds they will get 15 points added (default settings)
variable time "10"
variable time2 "15"
variable time3 "20"
# * Points we give for spamming/advertising
variable advert "40"
variable advert2 "50"
variable advert3 "60"
# * Points we give out for flood/spam
variable flood "15"
variable flood2 "10"
variable flood3 "5"
# * Points they need to get punished.
variable warn "80"
variable kick "100"
variable ban "120"
Code: Select all
if {$spamscan::spamscan} {
if {[advertisement $arguments]} {
if {$checktime >= $spamscan::time3} {
incr db($channel,$ident) $spamscan::advert3
} elseif {$checktime >= $spamscan::time2} {
incr db($channel,$ident) $spamscan::advert2
} else {
incr db($channel,$ident) $spamscan::advert
}
}
}
Code: Select all
if {$db($channel,$ident) >= $ban} {
putlog "$nickname was \0034banned\003 in $channel. \(score: $db($channel,$ident)\)"
set banmask [banmask $hostname]
putquick "MODE $channel +b $banmask"
putquick "KICK $channel $nickname :[string map "%nickname $nickname %channel $channel %id [expr [channel get $channel spamkicked] + 1]" [join $kickmsg]]"
channel set $channel spamkicked "[expr [channel get $channel spamkicked] + 1]"
if {$bantime != "0"} {
timer $bantime [list pushmode $channel -b $banmask]
}
} elseif {$db($channel,$ident) >= $kick} {
putlog "$nickname was \0038kicked\003 in $channel. \(score: $db($channel,$ident)\)"
putquick "KICK $channel $nickname :[string map "%nickname $nickname %channel $channel %id [expr [channel get $channel spamkicked] + 1]" [join $kickmsg]]"
channel set $channel spamkicked "[expr [channel get $channel spamkicked] + 1]"
}
Code: Select all
proc spamscan::advertisement {line} {
if {[regexp -- {\x23\S+|[a-zA-Z0-9]+://\S+\.[a-zA-Z0-9]+|www[0-9]*\.\S+\.[a-zA-Z]+} $line]} {
return 1
}
return 0
}
Code: Select all
(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]
Code: Select all
(\w+)\s+\1
Code: Select all
regexp -nocase {((http|ftp)://[^\s]+)} $text url
Anyone?Also I was wondering how can I detect repeated words in a string through regexp? Then count how many are present like with the -all switch I can do that. The main thing is to detect repeated words not characters.
Code: Select all
foreach word $words {
if {[info exists count($word)]} {
incr count($word)
} {
set count($word) 1
}
}