XKAntiSpam — File Browser
XKAntiSpamv1.4 / XKAntiSpamv1.4 / xkantispam.mrc
xkantispam.mrc — 3.85 KB — Download this file
;XKAntiSpam Version 1.3
on *:start: {
set %xka xkantispam.netfirms.com
if (%xkantispam == $null) %xkantispam = 1
xkupdate | .timerxka -io 0 86400 xkupdate
if ($hget(xkantispam) == $null) {
hmake xkantispam 50
if ($exists(" $+ $scriptdirxkantispam.txt") == $true) hload xkantispam " $+ $scriptdirxkantispam.txt"
}
}
alias xkupdate {
sockclose xka
sockopen xka %xka 80
}
on *:unload: {
.timerxka off
unset %xka
unset %xkantispam
unset %temp
unset %downloadlength
unset %downloadready
unset %header
unset %downloadoffset
}
on *:sockopen:xka: {
if ($sockerr == 0 ) {
sockwrite -n $sockname GET /ver.html HTTP/1.1
sockwrite -n $sockname Host: %xka $+ $str($crlf ,2)
.timerclosexka 1 60 sockclose xka
}
else { sockclose xka | halt }
}
on *:sockread:xka: {
sockread %temp
if (xkantispam version: isin %temp) && ($gettok(%temp,3,32) > $gettok($hget(xkantispam,1),4,32)) {
echo 6 -a There is a new version of XKAntiSpam.txt database. Updating it automatically, so please wait.
getxkantispam
}
}
alias getxkantispam {
if ($sock(getxkantispam)) {
return
}
sockopen getxkantispam %xka 80
}
on *:sockopen:getxkantispam: {
if ($sockerr) {
echo error $sockerr when downloading XKAntiSpam.txt
return
}
write -c " $+ $scriptdirXKAntiSpam.tmp"
unset %downloadlength %downloadready
sockwrite -n $sockname GET /XKAntiSpam.txt.zip HTTP/1.0
sockwrite -n $sockname Accept: */*
sockwrite -n $sockname Host: %xka
sockwrite -n $sockname
}
on *:sockread:getxkantispam: {
if (%downloadready != 1) {
var %header
sockread %header
while ($sockbr) {
if (Content-length: * iswm %header) {
; got the length of the file
%downloadlength = $gettok(%header,2,32)
}
elseif (* !iswm %header) {
%downloadready = 1
%downloadoffset = $sock($sockname).rcvd
break
}
sockread %header
}
}
if (%downloadlength == $null) { echo The file could not be found on the website | .remove " $+ $scriptdirXKAntiSpam.tmp" | sockclose getxkantispam | halt }
sockread 4096 &d
while ($sockbr) {
bwrite " $+ $scriptdirXKAntiSpam.tmp" -1 -1 &d
sockread 4096 &d
}
}
on *:sockclose:getxkantispam: {
if (%downloadlength == $null) halt
echo Done downloading XKAntiSpam.txt
var %b = $decompress(" $+ $scriptdirxkantiSpam.tmp")
if (%b == 1) {
.remove " $+ $scriptdirXKAntiSpam.txt"
.rename " $+ $scriptdirXKAntiSpam.tmp" " $+ $scriptdirXKAntiSpam.txt"
if ($exists(" $+ $scriptdirxkantiSpam.txt") == $true) {
hdel -w xkantispam *
hload xkantispam " $+ $scriptdirxkantispam.txt"
}
}
else {
echo 4 The XKAntiSpam.txt Seem to be corrupted. Using the old file
.remove " $+ $scriptdirXKAntiSpam.tmp"
}
}
on ^1:action:*:?: {
is-spam $1-
}
on ^*:TEXT:*:?: {
is-spam $1-
}
alias is-spam {
tokenize 32 $strip($1-)
if ($hfind(xkantispam,$1-,0,R).data > 0) {
echo 4 -s You probably got spammed by $nick $+ . $nick was added to your ignore list, and will be ignored for 1 hour.
ignore -u3600 $nick
close -m $nick
haltdef
}
elseif ((%xkantispam == 2) && ($nick != Global)) {
if (http: isin $1-) || (www. isin $1-) || (vv vv vv isin $1-) || (porn isin $1-) || (p0rn isin $1-) || (xxx isin $1-) || (freeipods isin $1-) || (*w.w.w* iswm $1-) || (*w-w-w* iswm $1-) || (*ยท?c?o?m* iswm $1-) {
echo 4 -s You probably got spammed by $nick $+ . $nick was added to your ignore list, and will be ignored for 1 hour.
ignore -u3600 $nick
close -m $nick
haltdef
}
}
:end
}
menu status,channel,chat,menubar {
XKAntiSpam block level
.$iif(%xkantispam == 1 , $style(1)) Normal {
%xkantispam = 1
}
.$iif(%xkantispam == 2 , $style(1)) High {
%xkantispam = 2
}
}