(@TCL-Tester) : Can't find spamlist for #opers
Code: Select all
bind PUB - * pub:spam
bind CTCP - ACTION ctcp:spam
bind PART - * part:spam
bind SIGN - * sign:spam
array set spamlist {}
proc pub:spam {nick uhost hand chan txt} {
add:spam $nick [string tolower $chan]
}
proc ctcp:spam {nick uhost hand chan key txt} {
add:spam $nick [string tolower $chan]
}
proc add:spam {nick chan} {
if {[info exists ::spamlist($chan)]} {
putserv "PRIVMSG $chan :spamlist exists for $chan"
set pos [lsearch -nocase [dict keys [join $::spamlist($chan)]] $nick]
if {$pos >= 0} {
putserv "PRIVMSG $chan :$nick was in, removing"
set ::spamlist($chan) [lreplace $::spamlist($chan) $pos $pos]
}
}
lappend ::spamlist($chan) [list $nick [clock seconds]]
putserv "PRIVMSG $chan :adding/updating $nick in $chan"
}
proc part:spam {nick uhost hand chan {txt ""}} {
ban:spam $nick $uhost [string tolower $chan]
}
proc sign:spam {nick uhost hand chan txt} {
ban:spam $nick $uhost [string tolower $chan]
}
proc ban:spam {nick uhost chan} {
if {![info exists ::spamlist($chan)]} {
putserv "PRIVMSG $chan :Can't find spamlist for $chan"
return
}
set pos [lsearch -nocase [dict keys [join $::spamlist($chan)]] $nick]
if {$pos > -1} {
scan [lindex $::spamlist($chan) $pos] {%s%s} user time
set now [clock seconds]
if {[expr $now - $time] < 6} {
set ::spamlist($chan) [lreplace $::spamlist($chan) $pos $pos]
set mask [maskhost "$nick!$uhost" 3]
pushmode $chan +b $mask
} else {
putserv "PRIVMSG $chan :More than 5s, doing nothing"
}
} else {
putserv "PRIVMSG $chan :Can't find $nick in spamlist of $chan"
}
}
Code: Select all
proc add:spam {nick chan} {
set match 0
if {[info exists ::spamlist($chan)]} {
putserv "PRIVMSG $chan :spamlist exists for $chan"
set pos [lsearch -nocase [dict keys [join $::spamlist($chan)]] $nick]
if {$pos > -1} {
putserv "PRIVMSG $chan :$nick was found in the list, skipping.."
incr match
}
}
if {!$match} {
putserv "PRIVMSG $chan :$nick wasn't in, adding.."
lappend ::spamlist($chan) [list $nick [clock seconds]]
}
}
Code: Select all
[16:00:00] --> spammer as joined #test
[16:00:01] * spammer says hello to all
[16:00:05] <spammer> go on http://omg.spamming.net
[16:00:07] <-- spammer has quit (http://omg.spamming.net)
Code: Select all
[16:59:57] <CrazyCat> Time to go, cya pple !
[16:59:59] <-- CrazyCat has quit (Cya)
17:29:54 (Greene) : testing one two three
17:29:54 Quits : Greene uid45646@uid-45646.highgate.irccloud.com (Quits: Left IRC)
17:29:54 (@TCL-Tester) : Can't find spamlist for #opers
17:30:27 (Burk) : testing one two three
17:30:27 Parts : Burk Jordon@BHYX1EUA.WGERDG6U.HVE14TFS.IP (Parts:)
17:30:27 (@TCL-Tester) : Can't find spamlist for #opers
Code: Select all
proc pub:spam {nick uhost hand chan txt} {
putserv "PRIVMSG $chan :get pub from $nick"
add:spam $nick [string tolower $chan]
putserv "PRIVMSG $chan :stored pub from $nick"
}
proc ctcp:spam {nick uhost hand chan key txt} {
putserv "PRIVMSG $chan :get act from $nick"
add:spam $nick [string tolower $chan]
putserv "PRIVMSG $chan :stored act from $nick"
}
Code: Select all
proc add:spam {nick chan} {
global spamlist
set match 0
set now [clock seconds]
if {[info exists spamlist($chan)]} {
putserv "PRIVMSG $chan :spamlist exists for $chan"
set pos [lsearch -nocase [dict keys [join $spamlist($chan)]] $nick]
if {$pos > -1} {
scan [lindex $spamlist($chan) $pos] {%s%s} user time
putserv "PRIVMSG $chan :$nick was found in the list, updating the seconds from $time to $now .."
set spamlist($chan) [lreplace $spamlist($chan) $pos $pos [list $user $now]]
incr match
}
}
if {!$match} {
putserv "PRIVMSG $chan :$nick wasn't in, adding.."
lappend spamlist($chan) [list $nick $now]
}
}