This is a simple query Blocker
How it work:
-There is a check button with 3 states
Mode Permission
Mode Block
Mode Standby
Mode permission dont block any query
Mode Block Block all queries
Mode standby ask you first, if you wish to allow the query request
there is another option:
Nick exception
when you add a nick in this list
even if the Mode Block and Mode Standby is activated
the nick in nicklist exception will be allowed to send request to you without permission
;Query Blocker
dialog QB {
title "Query Blocker"
size -1 -1 194 112
option dbu
tab "Query Blocker", 1, 3 5 185 94
check "Query State On/Off/Stand By", 2, 8 70 87 10, tab 1 3state
text "Choose a State for the Query Blocker:", 3, 8 60 101 8, tab 1
text "", 4, 8 86 107 8, tab 1
edit "", 5, 8 32 109 10, autohs tab 1
text "Choose a message to appear in Mode Block or Stand by:", 6, 8 22 138 8, tab 1
text "Ex: Im not accepting any Query", 7, 8 43 111 8, tab 1
button "Ok", 9, 119 31 25 12, tab 1
tab "Choose a nick", 10, 3 5 185 94
combo 11, 8 24 62 50, tab 10 drop size
list 12, 8 47 62 50, tab 10 size vsbar
text "Choosing a nick will automatically allow this nick to query you", 13, 75 20 108 21, tab 10
text "Choose nick:", 14, 8 38 48 8, tab 10
list 15, 92 58 73 35, tab 10 size vsbar
button "Add", 16, 71 70 17 12, tab 10
button "Del",17, 166 81 19 12, tab 10
text "Nicks allowed:", 18, 92 49 59 8, tab 10
}
alias QB { dialog $iif($dialog(QB), -v,-m) QB QB }
on *:dialog:QB:init:*:{
did -b qb 5,6,7,8
var %x = 1
while (%x <= $chan(0)) {
did -a QB 11 $chan(%x)
inc %x
}
if (%Blocker == on) {
did -ar qb 4 Mode Block is activated | did -e qb 5,6
}
if (%Permission == on) {
did -ar qb 4 Mode Permission is activated
}
if (%Standby == on) {
did -ar qb 4 Mode Stand by is activated | did -e qb 5,6
}
did $iif(%state,%state,-u) qb 2
$iif($isfile(qlist.txt), loadbuf -o qb 15 qlist.txt,write qlist.txt)
if (%Queryreason) {
did -a qb 5 %Queryreason
}
}
on *:dialog:QB:sclick:2:{
if ( $did(2).state == 0 ) {
set %state $replace($did(2).state,0,-u,1,-c,2,-cu) | unset %standby | unset %Blocker | set %Permission On | did -ar qb 4 Mode permission is now activated | did -b qb 5,6
}
if ( $did(2).state == 1 ) {
set %state $replace($did(2).state,0,-u,1,-c,2,-cu) | unset %Permission | unset %Standby | set %Blocker on | did -ar qb 4 Mode Block is now activated | did -e qb 5,6
}
if ( $did(2).state == 2 ) {
set %state $replace($did(2).state,0,-u,1,-c,2,-cu) | unset %Blocker | unset %Permission | set %Standby on | did -ar qb 4 Mode Stand by is now activated | did -b qb 5,6
}
}
on *:dialog:QB:sclick:*:{
if ($did == 11) {
var %x = 1
did -r qb 12
while (%x <= $nick($did(11).seltext,0)) {
did -a QB 12 $nick($did(11).seltext,%x)
inc %x
}
}
if (($did == 16) && ($did(12).seltext)) {
write qlist.txt $did(12).seltext
did -r qb 15 | loadbuf -o qb 15 qlist.txt
}
if (($did == 17) && ($did(15).seltext)) {
write -ds $did(15).seltext qlist.txt
did -r qb 15 | loadbuf -o qb 15 qlist.txt
}
if (($did == 9) && ($did(5) != $null)) {
set %Queryreason $did(5).text
did -ar qb 4 A message for Block mode has been set
}
}
on *:open:?:{
if ((%Blocker == on) && ($read(qlist.txt,w,* $+ $nick $+ *) != $nick)) {
.closemsg $nick | .msg $nick $iif(%Queryreason, %Queryreason, Im not accepting Query Now. Your request have been blocked) | echo -a 5- *** - nick $nick tryed a Query with You - *** - | ignore -u20pn $nick
}
if ((%Standby == on) && ($read(qlist.txt,w,* $+ $nick $+ *) != $nick)) {
.msg $nick Wait a minute, Your request has been sent to $me
echo -a 5- *** - $nick - $1-
.timerstand -m 1 1 Qstand $nick
}
}
alias Qstand {
/notice $1 Your query request has been sent to $me
var %query = $input(Nick $1 tryed a query with you. allow?,iy,Private)
if (%query == $false) {
.closemsg $1
.notice $1 Warning: Your query request was rejected
}
}
"on :dialog:QB:init::{
did -b qb 5,6,7,8"
You should remove the 8 or else the "Choose a nick" wont work :)
what are you talking about? $did(8) doesnt even exist in this script... it was an error, there is no ID 8
the fact of using a double warning, is:
if someone has a pm blocker too, it wont accept the query, so it will send a notice, of course ppl can remove it, and just have notice
"on :dialog:QB:init::{
did -b qb 5,6,7,8"
You should remove the 8 or else the "Choose a nick" wont work :)
Also i dont see the point in contacting the other user twice in Standby Mode
.msg $nick Wait a minute, Your request has been sent to $me
/notice $1 Your query request has been sent to $me
only the Notice should suffice.
Finally and ignore counter would be a nice addition.. that said nice simple query blocker :)