Bad Word Detection Engine (Using Socket)
Platform: mIRC
Published Oct 16, 2011
Updated Oct 16, 2011
I've submitted this snippet for fun. It's inspired by another snippet previously submitted by Someus. I thought I'd experiment and fiddle with a socket. And here is it.
The list of bad words is brought to you courtesy of:
http://aha-irc.net/list.txt
Of course, all constructive suggestions are welcome to improve this snippet.
on @*:text:*:#: bw $1-
on @*:action:*:#: bw $1-
on @*:notice:*:#: bw $1-
on *:sockopen:bw*:{
if (!$sockerr) {
tokenize 96 $str($chr(96) sockwrite -n $sockname,2)
$1 GET /list.txt HTTP/1.1
$2 Host: $+($sock($sockname).addr,$str($crlf,2))
}
}
alias -l bw {
var %b = $+(bw,$site,$r(1,9999),$ticks)
if ($sock(%b)) sockclose $v1
sockopen %b aha-irc.net 80
set -e %1- $strip($1-) | set -e %1-- kick # $nick No Swearing Please!
}
on *:sockread:bw*:{
if (!$sockerr) {
if (!$sock($sockname).mark) {
var %b | sockread %b
if (!%b) sockmark $sockname 1 | halt
}
while ($sock($sockname).rq > 0) {
sockread -fn &bw
if ($regex(%1-,/(^| )\Q $+ $bvar(&bw,1-).text $+ \E\b/)) {
%1-- | unset %1* | sockclose $sockname
}
}
}
}