I saw a Pm Blocker on hawkee from Andyhighton (http://www.hawkee.com/snippet/5733/) and I liked the idea, but wanted a few more options in the script, so I added some commands and changed the existing commands a bit.
To add someone to your allow list, just type: /addnick [Nick] or rightclick on a username > Pm Blocker > Add user
Delete a user from your allow list goes exactly the same as add a nick: /delnick [Nick] or rightclick on a username > Pm Blocker > Del user
To see al the nicks on your allow list type: /shownicks
To see everyone who tried to reach your PM, type: /fanpm
To clear everyone in the command fanpm, type: /clearpm
You can also add channels to your allow list... I'm talking about the line: if ($read(AcceptedNicks.txt, s, %host)) || ($nick isop #chan) || ($nick ison #chan) || ($nick isvoice #chan) {
First the script checks if someone is on your allow list, than you can add as many channels if you want. The first channel-command allows everyone that is an op on that chan to PM you, the second allows everyone on that chan and the 3rd one allows everyone with a voice on that chan to pm you.
I know the way I add users on channels is not the best way, so if you have suggestions how I can do this better, please tell me :)
To turn the PM Blocker on and off, just rightclick in a channel/menubar > PM Blocker > ON/OFF
Hope you like it! :)
P.S. Sorry for my English :x
alias AddNick {
.write AcceptedNicks.txt $address($1,2)
echo -a 7 $+ $1 is now added to Accepted Nicks.
}
alias DelNick {
.write -dl $readn AcceptedNicks.txt
echo -a 7 $+ $1 is now deleted from Accepted Nicks.
}
alias ShowNicks {
if (!$window(@AcceptedNicks)) window -znkg1 @AcceptedNicks
loadbuf @AcceptedNicks acceptednicks.txt
}
on ^*:OPEN:?:*: {
if (%PmBlocker == on) {
%host = $address($nick,2)
msg $nick Hey $nick $+ ! You have reached $me $+ .
msg $nick I have $query(0) query/ies open, and have been idle for $duration($idle) $+ .
if ($read(AcceptedNicks.txt, w, %host)) || ($nick isop #chan) || ($nick ison #chan) || ($nick isvoice #chan) {
msg $nick 7You are on my allow list $nick $+ , so I will read this sooner or later ;)
}
else {
.write TriedNicks.txt %host has tried to reach your PM on $fulldate $+ !
.msg $nick 7This is a PM Blocker. I'm sure you can guess what it does..
PmSpammer
halt
}
}
}
Alias PmSpammer {
if (!$window(@PmSpammer)) { window -znkg1 @PmSpammer
//echo @PmSpammer $nick has tried to reach your PM on $fulldate $+ !
}
}
Alias fanpm {
if (!$window(@TriedNicks)) { window -znkg1 @TriedNicks }
var %x $Lines(TriedNicks.txt)
while (%x) { //echo @TriedNicks $gettok($read(TriedNicks.txt,%x),1-,32) | dec %x }
}
Alias clearpm {
.write -c TriedNicks.txt
echo -a 7Cleared all nicks.
}
menu nicklist,query {
PM Blocker
.$iif($read(acceptednicks.txt,w,$address($1,2)),Del,Add) User:$iif($read(acceptednicks.txt,w,$address($1,2)),delnick,addnick) $$1
}
menu channel,menubar {
PM Blocker
.Set $iif(%PmBlocker == on,OFF,ON):set %PmBlocker $iif(%PmBlocker == on,off,on) | echo -a 7PM Blocker is now %PmBlocker $+ .
}
i told before
PS: i dont know why u check if the nick is op or voice or is in chan (mean if nick is regular) so u can just check if nick ison chan!
he replay > And I check if the nick is op or voice, because I want to allow only ops in some chans.. else someone can just come into the chan and than he can PM me... so for that reason I want to check if they are op or voice ;)
so now $nick(#chan,$nick,ovr) = if $nick ison # but he want to allow ops/voices in some chans then after the "$read" the condition should remain as it is
i just test the code no prob with nicklist may be u have something like nicklust.dll or another thing can do this prob
but i realized that u can check if nick exit or not in menu then u dont have to check and send an error msg that nick is already in accept nicks or other then in menu if this nick is in accepted nicks that will show del user or else add user
alias AddNick {
.write AcceptedNicks.txt $address($1,2)
echo -a 7 $+ $1 is now added to Accepted Nicks.
}
alias DelNick {
.write -dl $readn AcceptedNicks.txt
echo -a 7 $+ $1 is deleted from Accepted Nicks.
}
menu nicklist,query {
PM Blocker
.$iif($read(acceptednicks.txt,$address($1,2)),Del,Add) User:$iif($read(acceptednicks.txt,$address($1,2)),delnick,addnick) $$1
}
Ah yeah, now it works fine WorldDMT, but addnick and delnick only works in query and if someone talks in a chan, but not in the nicklist (for some reason I don't know :s)
And I check if the nick is op or voice, because I want to allow only ops in some chans.. else someone can just come into the chan and than he can PM me... so for that reason I want to check if they are op or voice ;)
yeah that wont work bcz you dont remove your file AcceptedNicks.txt delet it and try again
and remember if you use my way u have to edit someting in on open event
if ($read(AcceptedNicks.txt, s, %host)) || ($nick isop #chan) || ($nick ison #chan) || ($nick isvoice #chan) {
replace it by
if ($read(AcceptedNicks.txt,%host)) || ($nick(#chan,$nick,ovr) {
PS: i dont know why u check if the nick is op or voice or is in chan (mean if nick is regular) so u can just check if nick ison chan!
upper or lower dont bother
your alias can be at this style
alias AddNick {
var %r $read(acceptednicks.txt,$address($1,2))
if (!%r) .write AcceptedNicks.txt $address($1,2)
echo -a 7 $+ $1 is $iif(%r,already on,now added to) Accepted Nicks.
}
alias DelNick {
var %r $read(acceptednicks.txt,$address($1,2))
if (%r) .write -dl $readn AcceptedNicks.txt
echo -a 7 $+ $1 is $iif(%r,deleted from,not in) Accepted Nicks.
}
and about the alias shownicks u can use loadbuf
alias ShowNicks {
if (!$window(@AcceptedNicks)) window -znkg1 @AcceptedNicks
loadbuf @AcceptedNicks acceptednicks.txt
}
about on open event u can use $wildsite instead of $address($nick,2)
and use $nick(#,$nick,ov) instead of ($nick isop #chan) || ($nick ison #chan) || ($nick isvoice #chan)
finaly just a sugection about your menu on/off
menu channel,menubar {
PM Blocker
.Set $iif(%PmBlocker == on,OFF,ON):set %PmBlocker $iif(%PmBlocker == on,off,on) | echo -a 7PM Blocker is now %PmBlocker $+ .
}