the idea is to store each nick on join in a list after a check for not being admin ops halfops and such than to add in a list to send to a proc to do whois on all the stored nicks after like 5 minutes to check for blacklisted channels and clear all checked nicks from the stored list im not sure i'm on the right track with this code :
Code: Select all
namespace eval checkbadchan {
bind join - * [namespace current]::Djoin:badChnz:Checker
setudef flag chckbadchan
if {[string match "*BadChan:Scan*" [utimers]] == 0} {
utimer 5 [namespace current]::BadChan:Scan
}
proc Djoin:badChnz:Checker {nick uhost hand chan} {
global chkbchan
if {![channel get $chan chckbadchan]} { return 0 }
if {[isbotnick $nick] || [matchattr $hand of|of $chan]} { return 0 }
after [expr {2*1000*1}] [list [namespace current]::Delay-join:badChnz:Chk $nick $uhost $chan]
}
proc Delay-join:badChnz:Chk {nick uhost chan} {
global chkbchan
set ::badchanwhois [list]
if {![channel get $chan chckbadchan]} { return 0 }
if {[isbotnick $nick] || [isop $nick $chan] || [ishalfop $nick $chan] || [matchattr [nick2hand $nick] of|of $chan]} { return 0 }
if {[lsearch -exact $::badchanwhois "[string tolower $nick] $chan"] == -1} { lappend ::badchanwhois [string tolower $nick] $chan }
}
proc BadChan:Scan { } {
set badwhoisonchan [list]
if {[string match "*BadChan:Scan*" [utimers]] == 0} {
utimer 5 [namespace current]::BadChan:Scan
}
if {![info exists ::badchanwhois]} { return 0 }
foreach {nick chan} $::badchanwhois {
if {[onchan $nick $chan] } { lappend badwhoisonchan [string tolower $nick] }
}
if {[info exists badwhoisonchan]} { [namespace current]::Stck:WHoiZ $chan $badwhoisonchan }
}
proc Stck:WHoiZ {chan userList {max 20}} {
set ::chanxer $chan
set userList [lsort -unique $userList]
set count [llength $userList]
set counter 0
while {$count > 0} {
if {$count > $max} {
set users [join [lrange $userList 0 [expr {$max - 1}]] ","]
set userList [lreplace $userList 0 [expr {$max -1}]]
incr count -$max
} else {
set users [join $userList ","]
set count 0
}
incr counter 1
after [expr {$counter*5000}] [list putserv "Whois :$users"]
}
bind raw - 319 [namespace current]::Check_BChanz
}
proc Check_BChanz {from key arg} {
global listbadchans
set chans [list]
set args [join $arg]
set nick [lindex $arg 1]
if {[onchan $nick $::chanxer]} { set chost [getchanhost $nick $::chanxer] }
set badchans [list]
set chans [lrange $args 2 e]
foreach tok $chans {
set tok [string trimleft $tok ":@%+"]
if {[regexp -nocase {slut|bdsm|s[0o]d[0o]m|daughter|wh[0o]r[3e]|subm[i1]ss[1i]v[3e]|s[3e]ks|s[3e]cs|tits|pr[3e]gn[4a]t[1i]|pregnant|Rape|r[0o]l[3e]pl[a4]y|ambition|s[3e]ks|g[a4]y|[sf][4u]ck|inc[3e]st|s[3e]x|th[i1]rsty|c[4u]m|t[3e][3e]nw[a4]nk[i1]n|h[0o]m[0o|se(x|ks)|(s|f)uck|p(orn|0rn|enis)|h[0o]rny} $tok]} {
lappend badchans $tok
}
}
if {[llength $badchans]} {
putlog "Bad Channel Detected For $nick - [join $badchans]"
if {[string match -nocase "*@*irccloud*" $chost]} {
set ident [string trimleft [lindex [split $chost @] 0] "~"]
set xbmaskx [string map {sid id uid id} $ident]
set bmask *!*[string tolower $xbmaskx ]@*
} else { set bmask "*!*@[lindex [split $chost "@"] 1]" }
if {![ischanban $bmask $::chanxer]} { pushmode $::chanxer +b $bmask }
if {[onchan $nick $::chanxer]} {
putserv "privmsg $nick :\00312,00 $nick \00301 You Are In An Unallowed Channel\(S\)\: \00306 \037[join $badchans]\037 \00301 Part It/Them And Rejoin \00310 \037$::chanxer\037 \00301 Later After Your Ban Has Expired \017"
putserv "kick $::chanxer $nick :\002\00312,00 «-BAD/BlackListed & OR Spam CHANNEL DETECTED-» \017" }
}
return 0
}
}
putlog "[file normalize [info script]]"
Thanks in advance.