Home > Code, mIRC > antispam.mrc – Block spammers

antispam.mrc – Block spammers

1
2
3
4
5
;;;; Anti Spam v1.0.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan aka. b|man.                                  ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don’t know how to do this, then perhaps ;;
;; you shouldn’t be using this script. ;;
;; ;;
;; Very simple spamblocking script, blocks private message if they contain a ;;
;; word (usually urls) that are stored in it’s dbfile. ;;
;; ;;
;; Right click in a query window, or click the custom menu in the menubar to ;;
;; configure it/enable it. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.0.0 ;;
;; + Initial release. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Make sure the variable, with the file containing the list of blocked strings
;; are set at script start.
on *:START:{
set %_antispam_dbfile spamdb.txt
echo -tc info *** Anti-Spam by Brian Schmidt loaded..
}

alias antispam {
if ($1 == add || $1 == a) {
if (!$read(%_antispam_dbfile,w,$$2)) {
write %_antispam_dbfile $encode($$2)
echo -tac info *** Adding $$2 to %_antispam_dbfile
}
else {
echo -tac info *** $$2 allready in %_antispam_dbfile
}
}
elseif ($1 == remove || $1 == rem || $1 == r || $1 == delete || $1 == del || $1 == d) {
if ($read(%_antispam_dbfile,w,$encode($$2))) {
write -dw $encode($$2) %_antispam_dbfile
echo -tac info *** Removed $$2 from %_antispam_dbfile
}
else {
echo -tac info *** $$2 not in %_antispam_dbfile
}
}
elseif ($1 == check || $1 == c) {
if (%_antispam_status != $null && %_antispam_status != 0 && %_antispam_status != off) {
var %i 1
while (%i <= $numtok($2-,32)) {
if ($read(%_antispam_dbfile,w,$encode($gettok($2-,%i,32)))) {
if ($line($nick,0) == 0) {
window -c $window($nick)
}
halt
}
inc %i
}
}
}
elseif ($1 == status) {
if ($2 == 1 || $2 == on) {
set %_antispam_status 1
echo -tac info *** Anti-Spam enabled.
}
elseif ($2 == 0 || $2 == off) {
set %_antispam_status 0
echo -tac info *** Anti-Spam disabled.
}
}
elseif ($1 == list || $1 == l) {
window -dClk0 @Anti-Spam
var %c = $lines(%_antispam_dbfile)
if (%c > 0) {
var %i = 1
while (%i <= %c) {
aline -p @Anti-Spam $decode($read(%_antispam_dbfile,t,%i))
inc %i
}
}
}
}

;; The popup menus.
menu query,menubar {
-
Anti-Spam
.$iif(%_antispam_status == 0 || %_antispam_status == $null,Enable):antispam status on
.$iif(%_antispam_status == 1,Disable):antispam status off
.Configure:antispam list
-
}
menu @Anti-Spam {
dclick:if ($input(Delete $line(@Anti-Spam,$1),y,Confirm delete)) { antispam rem $line(@Anti-Spam,$1) | dline @Anti-Spam $1 }
Add..:var %antispam_tmp_add $input(Add spamline,e) | antispam add %antispam_tmp_add | aline @Anti-Spam %antispam_tmp_add
}

;; Catch all (private) text and check it for spam.
on ^&*:TEXT:*:?:{
antispam check $1-
}
on ^&*:ACTION:*:?:{
antispam check $1-
}

Categories: Code, mIRC Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.