Here's a pretty simple Query Blocker. It uses hash tables to store the info. You can add pm to be allowed to pm you via the nicklist. People are added by ident@host not by nick. Also, a few notes. This halts the query window from opening, so you will not know whne someone messages you. It will only respond to someone from a specific ident@host once every 60 seconds. Right now, Im using /userhost to get the address if they arent in your ial, so if your server doesnt support that, this would have to be changed to use whois. Echoes the result to the active window.
menu nicklist {
Pm Control
.Allow PMs From $1:PmControl add $$1
.Disallow PMs From $1:PmControl Del $$1
}
alias PmControl {
if ( $1 == add ) {
if ( $address($2,0) != $null ) {
hadd -m PmControl $right($address($2,0),-2)
echo 3 -a Added $right($address($2,0),-2) to PmAccept List
}
else {
.enable #userhostadd
userhost $2
}
}
if ( $1 == del ) {
if ( $address($2,0) != $null ) {
hdel PmControl $right($address($2,0),-2)
echo 3 -a Removed $right($address($2,0),-2) From the PmAccept List
}
else {
.enable #userhostdel
userhost $2
}
}
}
#userhostadd off
raw 302:*: {
hadd -m PmControl $right($gettok($1-,2,61),-1)
echo 3 -a Added $right($address($2,0),-2) to PmAccept List
.disable #userhostadd
halt
}
#userhostadd end
#userhostdel off
raw 302:*: {
hdel PmControl $right($gettok($1-,2,61),-1)
echo 3 -a Removed $right($address($2,0),-2) From the PmAccept List
.disable #userhostdel
halt
}
#userhostdel end
on ^*:open:?:*: {
if ( !$hfind(PmControl,$address) ) {
hinc -mu60 PmControl $+(Flood.,$address)
if ( $hget(PmControl,$+(Flood.,$address)) == 1 ) {
.msg $nick Sorry this PM Has been automatically rejected as you are not on my accept list. Please Contact me through a Known Channel.
}
halt
}
}
On *:start: {
hmake PmControl 20
$iif( $isfile(PmControl.hsh) , hload PmControl PmControl.hsh )
}
on *:Exit: {
hsave -o PmControl PmControl.hsh
hfree PmControl
}