rendered paste bodyalias blockall { .ignore -p * }
alias bod.pm.version { return v1.14 }
alias bod.pm.messageSend { $iif(%bod.send.waitMessage,return sent,return not sent) }
alias bod.status { if (%bod.pm.active) { return active } | else { return deactive } }
alias bodActivate { set %bod.pm.active $true | echo -a BOD: Secure Queries is activated. }
alias bodDeActivate { set %bod.pm.active $false | echo -a BOD: Secure Queries is deactivated. }
alias bod.getMessage { return [ [ %bod.message ] ] }
alias inform { set %bod.temp.inform $$1 | dialog -om inform inform }
alias secureQ { dialog -m secureq secureq | filter -ffct 1 32 kPMallowList.txt kPMallowList.txt }
alias unblockall { .ignore -pr * }
on *:START:{
unset %bodPM*
if (!$isfile(kPMallowList.txt)) { write kPMallowList.txt $me }
filter -ffct 1 32 kPMallowList.txt kPMallowList.txt
}
on *:LOAD:{
if (!$isfile(kPMallowList.txt)) { write kPMallowList.txt $me }
write kPMallowList.txt
set %bod.pm.active $true
set %bod.flood.count 0
set %bod.flood.max 6
set %bod.flood.resetTime 11
set %bod.send.waitMessage $true
set %bod.message Sorry, but your query has been automatically rejected as you are not on my acceptance list. Please stand by. My idle time is: $duration($gettok(%xi,1,32)) $+ . (Active Queries: $query(0) $+ . Queries since $asctime(%install.time,dd.mm.yyyy) $+ : %querynumber $+ . $+($chr(81),$chr(117),$chr(101),$chr(114),$chr(105),$chr(101),$chr(115)) per $+($chr(100),$chr(97),$chr(121)) $+ : $round($calc(%querynumber /(($ctime -%install.time)/86400)),1) $+ . Query Blocker by: $+($chr(76),$chr(105),$chr(110),$chr(100),$chr(114),$chr(105),$chr(97),$chr(110)) ( $+ $bod.pm.version $+ ))
set %bod.message.away Sorry, but your query has been automatically rejected as you are not on my acceptance list. Please stand by. I am also away, reason: $awaymsg $+ . Been away for: $duration($awaytime) $+ . If it's urgent, write an e-mail to: %mailaddy $+ . (Active queries: $query(0) $+ . Queries since $asctime(%install.time,dd.mm.yyyy) $+ : %querynumber $+ . $+($chr(81),$chr(117),$chr(101),$chr(114),$chr(105),$chr(101),$chr(115)) per $+($chr(100),$chr(97),$chr(121)) $+ : $round($calc(%querynumber /(($ctime -%install.time)/86400)),1) $+ . Query Blocker by: $+($chr(76),$chr(105),$chr(110),$chr(100),$chr(114),$chr(105),$chr(97),$chr(110)) ( $+ $bod.pm.version $+ ))
}
/*
on *:TEXT:*:?:{
if (%bod.pm.active) {
if (%bodPMkNickAllow == $nick) {
-a wtf!
set %bodPM [ $+ [ $nick ] ] $addtok(%bodPM [ $+ [ $nick ] ],$1-,59)
set %bodPM [ $+ [ $nick $+ time ] ] $addtok(%bodPM [ $+ [ $nick $+ time ] ],$timestamp,126)
}
}
}
*/
on ^*:OPEN:?:*:{
if ($nick ison #support) || ($nick ison #vhost) { goto kAprooved }
.timer.bod.flood.count.reset 1 %bod.flood.resetTime set % $+ bod.flood.count 0
if ($nick != %bodPMkNickAllow) {
inc %bod.flood.count
}
if (%bod.pm.active == $true) {
var %x = 1
while ($read(kPMallowList.txt,%x)) {
var %nick = $gettok($ifmatch,1,32)
if ($nick == %nick) { goto kAprooved }
inc %x
}
var %find.user $+(*,$nick,$chr(58),*)
set %bodPM [ $+ [ $nick ] ] $addtok(%bodPM [ $+ [ $nick ] ],$1-,59)
set %bodPM [ $+ [ $nick $+ server ] ] $cid
set %bodPM [ $+ [ $nick $+ time ] ] $addtok(%bodPM [ $+ [ $nick $+ time ] ],$timestamp,126)
if ($nick == %bodPMkNickAllow) { halt }
set %bodPMkNickAllow $nick
if (!$window(@messages)) { window -k0nlg1 @messages }
if (%bod.flood.count > %bod.flood.max) {
echo -at 2 12Attempt at flood detected; Outgoing messages will be halted for the next 2(15 $+ %bod.flood.resetTime $+ 2)12 seconds.
aline -h @messages $timestamp $nick $+ : $1-
halt
}
if ($numtok(%bodPM [ $+ [ $nick ] ],59) == 1) {
if (%bod.send.waitMessage) {
if ($away) {
.Msg $nick Sorry, but your query has been automatically rejected as you are not on my acceptance list. Please stand by. I am also away, reason: $awaymsg $+ . Been away for: $duration($awaytime) $+ . If it's urgent, write an e-mail to: %mailaddy $+ . (Active queries: $query(0) $+ . Queries since $asctime(%install.time,dd.mm.yyyy) $+ : %querynumber $+ . $+($chr(81),$chr(117),$chr(101),$chr(114),$chr(105),$chr(101),$chr(115)) per $+($chr(100),$chr(97),$chr(121)) $+ : $round($calc(%querynumber /(($ctime -%install.time)/86400)),1) $+ . Query Blocker by: $+($chr(76),$chr(105),$chr(110),$chr(100),$chr(114),$chr(105),$chr(97),$chr(110)) ( $+ $bod.pm.version $+ ))
.msg $nick Leave a message, I will read it as fast as possible!
}
else {
.msg $nick Sorry, but your query has been automatically rejected as you are not on my acceptance list. Please stand by. My idle time is: $duration($idle) $+ . (Active Queries: $query(0) $+ . Queries since $asctime(%install.time,dd.mm.yyyy) $+ : %querynumber $+ . $+($chr(81),$chr(117),$chr(101),$chr(114),$chr(105),$chr(101),$chr(115)) per $+($chr(100),$chr(97),$chr(121)) $+ : $round($calc(%querynumber /(($ctime -%install.time)/86400)),1) $+ . Query Blocker by: $+($chr(76),$chr(105),$chr(110),$chr(100),$chr(114),$chr(105),$chr(97),$chr(110)) ( $+ $bod.pm.version $+ ))
.msg $nick Leave a message! I will read it when im back.
}
aline -h @messages $timestamp $nick $+ : $1-
}
halt
:kAprooved
unset %bodPMkNickAllow
}
}
}
on *:CLOSE:?:{
if (%bod.pm.active == $true) {
unset %bodPM [ $+ [ $target ] ]
unset %bodPM [ $+ [ $target $+ time ] ]
}
}
alias kAllow {
if (%bod.pm.active == $true) {
scid %bodPM [ $+ [ $1 $+ server ] ]
query $1
var %x = 1
while ($gettok(%bodPM [ $+ [ $1 ] ],%x,59) != $null) {
echo -a $gettok(%bodPM [ $+ [ $1 $+ time ] ],%x,126) 2(10 $+ $1 $+ 2)10 $gettok(%bodPM [ $+ [ $1 ] ],%x,59)
inc %x
}
if (%bod.send.waitMessage) {
.msg $1 Your query has been accepted.
}
if (%bodPMkNickAllow == $1) {
unset %bodPMkNickAllow
}
unset %bodPM [ $+ [ $1 ] ]
unset %bodPM [ $+ [ $1 $+ time ] ]
unset %bodPM [ $+ [ $1 $+ server ] ]
}
else { $inform(Error: $crlf BOD: Secure Queries is De-Activated. $crlf Type /bodactivate to activate.) }
}
alias kdecline {
if (%bod.pm.active == $true) {
scid %bodPM [ $+ [ $1 $+ server ] ]
unset %bodPM [ $+ [ $1 ] ]
unset %bodPMkNickAllow
unset %bodPM [ $+ [ $1 $+ time ] ]
unset %bodPM [ $+ [ $1 $+ server ] ]
if (%bod.send.waitMessage) {
.msg $1 Your query has been rejected.
}
}
else { $inform(Error: $crlf BOD: Secure Queries is De-Activated. $crlf Type /bodactivate to activate.) }
}
alias kAlwaysAllow {
if (%bod.pm.messageline == $null) { set %bod.pm.messageline }
if (%bod.pm.added == $null) { set %bod.pm.added }
if (%bod.pm.addto == $null) { set %bod.pm.addto }
var %left = $2
if ($2 == $null) { var %left = 1 }
if (%bod.pm.active == $true) {
var %x = 1
var %exists = $false
while ($read(kPMallowList.txt,%x)) {
var %nick = $gettok($ifmatch,1,32)
if ($1 == %nick) { %exists = $true }
inc %x
}
if (%exists) {
set %bod.pm.added $addtok(%bod.pm.added,$1,44)
}
else {
write kPMallowList.txt $1
set %bod.pm.addto $addtok(%bod.pm.addto,$1,44)
}
if (%left == 1) {
if (%bod.pm.addto) { set %bod.pm.messageline $addtok(%bod.pm.messageline,Added %bod.pm.addto to your white list.,13) }
if (%bod.pm.added) { set %bod.pm.messageline $addtok(%bod.pm.messageline,%bod.pm.added is already on your white list.,13) }
if ($chr(44) isin %bod.pm.messageline) {
var %last.nick = $gettok(%bod.pm.messageline,$numtok(%bod.pm.messageline,44),44)
%last.nick = $gettok(%last.nick,1,32)
set %bod.pm.messageline $replace(%bod.pm.messageline,$chr(44), $chr(44) $+ $chr(32))
set %bod.pm.messageline $replace(%bod.pm.messageline,%last.nick, and %last.nick)
}
.timer 1 5 .unset %bod.pm.messageline
.timer 1 5 .unset %bod.pm.added
.timer 1 5 .unset %bod.pm.addto
$inform(%bod.pm.messageline)
}
}
else { $inform(Error: $crlf BOD: Secure Queries is De-Activated. $crlf Type /bodactivate to activate.) }
}
alias kRemoveAllow {
if (%bod.pm.messageline.rm == $null) { set %bod.pm.messageline.rm }
if (%bod.pm.removed == $null) { set %bod.pm.removed }
if (%bod.pm.gone == $null) { set %bod.pm.gone }
var %left = $2
if ($2 == $null) { var %left = 1 }
if (%bod.pm.active == $true) {
var %x = 1
var %exists = $false
while ($read(kPMallowList.txt,%x)) {
var %nick = $gettok($ifmatch,1,32)
if ($1 == %nick) { %exists = $true | write -dl $+ %x kPMallowList.txt }
inc %x
}
if (%exists) {
set %bod.pm.removed $addtok(%bod.pm.removed,$1,44)
}
else {
set %bod.pm.gone $addtok(%bod.pm.gone,$1,44)
}
if (%left == 1) {
if (%bod.pm.removed) {
if ($numtok(%bod.pm.removed,44) == 2) { set %bod.pm.removed $replace(%bod.pm.removed,$chr(44), $chr(32) $+ and $+ $chr(32) ) }
set %bod.pm.messageline.rm $addtok(%bod.pm.messageline.rm, Removed %bod.pm.removed from your white list.,13)
}
if (%bod.pm.gone) {
if ($numtok(%bod.pm.gone,44) == 2) { set %bod.pm.gone $replace(%bod.pm.removed,$chr(44), $chr(32) $+ and $+ $chr(32) ) }
set %bod.pm.messageline.rm $addtok(%bod.pm.messageline.rm, %bod.pm.gone was not found.,13)
}
if ($chr(44) isin %bod.pm.messageline.rm) {
var %last.nick = $gettok(%bod.pm.messageline.rm,$numtok(%bod.pm.messageline.rm,44),44)
%last.nick = $gettok(%last.nick,1,32)
set %bod.pm.messageline.rm $replace(%bod.pm.messageline.rm,$chr(44), $chr(44) $+ $chr(32))
set %bod.pm.messageline.rm $replace(%bod.pm.messageline.rm,%last.nick, and %last.nick)
}
.timer 1 5 .unset %bod.pm.messageline.rm
.timer 1 5 .unset %bod.pm.removed
.timer 1 5 .unset %bod.pm.gone
$inform(%bod.pm.messageline.rm)
}
}
else { $inform(Error: $crlf BOD: Secure Queries is De-Activated. $crlf Type /bodactivate to activate.) }
}
alias MasskAlwaysAllow {
if (%bod.pm.active == $true) {
var %i = $snick($1,0),%x
while (%i) {
if ($snick($1,%i)) {
%x = $snick($1,%i)
kAlwaysAllow %x %i
%x = ""
}
dec %i
}
}
else { $inform(Error: $crlf BOD: Secure Queries is De-Activated. $crlf Type /bodactivate to activate.) }
}
alias MasskRemoveAllow {
if (%bod.pm.active == $true) {
var %i = $snick($1,0),%x
while (%i) {
if ($snick($1,%i)) {
%x = $snick($1,%i)
kremoveallow %x %i
%x = ""
}
dec %i
}
}
else { $inform(Error: $crlf BOD: Secure Queries is De-Activated. $crlf Type /bodactivate to activate.) }
}
alias bod.fill.whitelist {
.filter -ffct 1 32 kPMallowList.txt kPMallowList.txt
var %table = $1
var %list = $2
var %x = 1
var %lines = $lines(kPMallowList.txt)
while (%x <= %lines) {
var %nick = $gettok($read(kPMallowList.txt,%x),1,32)
/did -a %table %list %nick
inc %x
}
}
alias bod.queries {
var %ret
if ($ignore(0) => 1) {
var %x = 1
while (%x <= $ignore(0)) {
if ($ignore(%x).type == private) { %ret = blocked }
inc %x
}
}
else { %ret = monitored }
return %ret
}
alias bod.window.remove {
var %window = $1
var %string = $+(*,$2-,*)
var %total = $line(%window,0)
var %x = 1
while (%x <= %total) {
var %line = $line(%window,%x)
if (%string iswm %line) {
dline %window %x
}
inc %x
}
}
alias bod.window.remove2 {
var %window = $1
var %string = $+(*,$1-,*)
var %total = $line(%window,0)
var %x = 1
while (%x <= %total) {
var %line = $line(%window,%x)
if (%string iswm %line) {
dline %window %x
}
inc %x
}
}
alias bod.window.remove3 {
var %window = $1
var %string = $+(*,%bodPMkNickAllow,*)
var %total = $line(%window,0)
var %x = 1
while (%x <= %total) {
var %line = $line(%window,%x)
if (%string iswm %line) {
dline %window %x
}
inc %x
}
}
Dialog inform {
Title "Message"
Size -1 -1 300 100
Text %bod.temp.inform , 1, 0 10 300 80, center
Button "OK", 2, 111 70 90 25,ok
}
Dialog SecureQ {
Title "Secure Queries"
Size -1 -1 200 250
Tab "General", 1, 0 10 200 240,
Tab "Settings", 18
Tab "White List", 2
Text "Active", 3, 20 40 89 19, tab 1
Button "&on", 4, 30 56 30 19, tab 1
Button "o&ff", 5, 60 56 34 19, tab 1
Text "Queries", 6, 20 80 89 19, tab 1
Button "&Block ALL Queries", 7, 30 96 139 19, tab 1
Button "&Unblock ALL Queries", 8, 30 116 139 19, tab 1
List 9, 20 45 89 200, tab 2
Button "&add user", 10, 130 100 60 23, tab 2
Button "&remove user", 11, 120 125 70 23, tab 2
Box "Status", 12, 10 158 180 85, tab 1
Text $bod.status, 13, 25 170 50 15, tab 1
Text queries are $bod.queries, 14, 25 183 130 15, tab 1
Text max lines: %bod.flood.max, 15, 25 196 100 15, tab 1
Text seconds before flood reset: %bod.flood.resetTime, 16, 25 209 160 15, tab 1
Button "remov&e all", 17, 120 150 70 23, tab 2
Button "&Clear Unanswered Queries", 19, 30 136 139 18, tab 1
Text "Max lines before flood protection", 20, 10 115 180 15, tab 18
Edit %bod.flood.max, 22, 10 130 30 20, tab 18
Text "Seconds before reset", 23, 10 160 180 15, tab 18
Edit %bod.flood.resetTime, 25, 10 175 30 20, tab 18
Button "?", 26, 40 130 20 19, tab 18
Button "?", 27, 40 175 20 19, tab 18
check "Send 'wait for response' message.", 28, 10 40 180 15, tab 18
Text "Message to send:", 29, 10 60 100 15, tab 18
Edit $bod.getMessage, 30, 10 80 160 20, tab 18 autohs
Button "ok", 31, 80 199 120 23, tab 18
Button "?", 32, 175 80 20 19, tab 18
Text "", 33, 10 100 180 15, tab 18 disabled
Button "Reset to Defaults", 34, 80 222 120 23, tab 18
Text Messages are $bod.pm.messageSend, 35, 25 222 160 15, tab 1
}
on *:dialog:secureq:sclick:*:{
if ($did == 2) {
.did -r $dname 9
.bod.fill.whitelist $dname 9
}
if ($did == 4) {
.bodactivate
.did -i secureq 13 13 $bod.status
}
if ($did == 5) {
.boddeactivate
.did -i secureq 13 13 $bod.status
}
if ($did == 7) {
.blockall
.did -i secureq 14 14 queries are $bod.queries
}
if ($did == 8) {
unblockall
.did -i secureq 14 14 queries are $bod.queries
}
if ($did == 10) {
var %nick = $?="nickname of user to add:"
.did -r $dname 9
.write kPMallowList.txt %nick
.bod.fill.whitelist $dname 9
}
if ($did == 11) {
if (!$did($dname,9).sel) { $inform(No selection made!) | halt }
var %removed = 0
var %nick = $did($dname,9,$did($dname,9).sel).text
var %x = 1
var %lines = $lines(kPMallowList.txt)
while (%x <= %lines) {
var %allowed.nick = $gettok($read(kPMallowList.txt,%x),1,32)
if (%nick == %allowed.nick) {
.write -dl $+ $calc($readn - %removed) kPMallowList.txt
inc %removed
}
inc %x
}
.did -r $dname 9
.bod.fill.whitelist $dname 9
}
if ($did == 17) {
%bod.remAll = $?!="Are you sure you want to remove ALL the entries in the white list?"
if (%bod.remAll) {
.remove kPMallowList.txt
.write kPMallowList.txt
.did -r $dname 9
}
}
if ($did == 18) {
if (%bod.send.waitMessage) { .did -c $dname 28 }
else { .did -u $dname 28 }
}
if ($did == 19) {
if ($?!="Are you sure you want to clear ALL the queries?") {
if ($window(@messages)) {
clear @messages
}
unset %bodPM*
}
}
if ($did == 26) {
$inform(This is the maximum amount of times that your script will respond with the "wait for response" message in a given amount of time. This is to decrease the chance of flooding off.)
}
if ($did == 27) {
$inform(This is the amount of seconds to wait before starting to send the "wait for response" message.))
}
if ($did == 28) {
if ($did(secureq,28).state == 0) {
set %bod.send.waitMessage $false
.did -i secureq 35 35 Wait messages are not sent.
}
else {
set %bod.send.waitMessage $true
.did -i secureq 35 35 Wait messages are sent.
}
}
if ($did == 31) {
.set %bod.message $did($dname,30).text
.set %bod.flood.max $did($dname,22).text
.set %bod.flood.resetTime $did($dname,25).text
.did -i secureq 15 15 max lines: %bod.flood.max
.did -i secureq 16 16 seconds before flood reset: %bod.flood.resetTime
if ($?!="Close window?") { dialog -x $dname }
}
if ($did == 32) {
$inform(This is a message telling the user that messaged you to wait until you respond to his/her query.)
}
if ($did == 34) {
set %bod.pm.active $true
set %bod.flood.count 0
set %bod.flood.max 6
set %bod.flood.resetTime 11
set %bod.send.waitMessage $true
set %bod.message Sorry, but your query has been automatically rejected as you are not on my acceptance list. Please stand by. My idle time is: $duration(%x.i) $+ . (Active Queries: $query(0) $+ . Queries since $asctime(%install.time,dd.mm.yyyy) $+ : %querynumber $+ . $+($chr(81),$chr(117),$chr(101),$chr(114),$chr(105),$chr(101),$chr(115)) per $+($chr(100),$chr(97),$chr(121)) $+ : $round($calc(%querynumber /(($ctime -%install.time)/86400)),1) $+ . Query Blocker by: $+($chr(76),$chr(105),$chr(110),$chr(100),$chr(114),$chr(105),$chr(97),$chr(110)) ( $+ $bod.pm.version $+ ))
set %bod.message.away Sorry, but your query has been automatically rejected as you are not on my acceptance list. Please stand by. I am also away, reason: $awaymsg $+ . Been away for: $duration($awaytime) $+ . If it's urgent, write an e-mail to: %mailaddy $+ . (Active queries: $query(0) $+ . Queries since $asctime(%install.time,dd.mm.yyyy) $+ : %querynumber $+ . $+($chr(81),$chr(117),$chr(101),$chr(114),$chr(105),$chr(101),$chr(115)) per $+($chr(100),$chr(97),$chr(121)) $+ : $round($calc(%querynumber /(($ctime -%install.time)/86400)),1) $+ . Query Blocker by: $+($chr(76),$chr(105),$chr(110),$chr(100),$chr(114),$chr(105),$chr(97),$chr(110)) ( $+ $bod.pm.version $+ ))
.did -i secureq 13 13 $bod.status
.did -i secureq 14 14 queries are $bod.queries
.did -i secureq 15 15 max lines: %bod.flood.max
.did -i secureq 16 16 seconds before flood reset: %bod.flood.resetTime
.did -i secureq 35 35 Wait messages are sent
.did -i secureq 22 22 %bod.flood.max
.did -i secureq 25 25 %bod.flood.resetTime
$iif(%bod.send.waitMessage,.did -c $dname 28,.did -u $dname 28)
}
}
menu nicklist {
$iif($1,Secure Query)
.$iif(%bodPMkNickAllow != $1,$style(2)) Allow Current Query From $1:kallow $1 | bod.window.remove2 @messages $remove($1,$chr(58))
.$iif(%bodPMkNickAllow != $1,$style(2)) Decline Current Query From $1:kdecline $1 | bod.window.remove2 @messages $remove($1,$chr(58))
.Add selected to 'white list':masskalwaysallow $$chan
.Remove selected from 'white list':masskremoveallow $$chan
}
menu query {
$iif($1,Secure Query)
.$iif(%bodPMkNickAllow != $1,$style(2)) Allow Current Query From %bodPMkNickAllow:kallow %bodPMkNickAllow | bod.window.remove2 @messages $remove($1,$chr(58))
.$iif(%bodPMkNickAllow != $1,$style(2)) Decline Current Query From %bodPMkNickAllow:kdecline %bodPMkNickAllow | bod.window.remove2 @messages $remove($1,$chr(58))
.Add $1 to 'white list':kalwaysallow $$1
.Remove $1 from 'white list':kremoveallow $$1
}
menu channel,status {
$iif($server == $null,$style(2)) Secure Query
.$iif(%bodPMkNickAllow == $null,$style(2)) Allow Current Query From %bodPMkNickAllow:kallow %bodPMkNickAllow | bod.window.remove3 @messages $remove(%bodPMkNickAllow,$chr(58))
.$iif(%bodPMkNickAllow == $null,$style(2)) Decline Current Query From %bodPMkNickAllow:kdecline %bodPMkNickAllow | bod.window.remove3 @messages $remove(%bodPMkNickAllow,$chr(58))
.Open dialog:secureq
}
menu @messages {
$remove($gettok($1-,2,32),$chr(58))
.Accept query:{
kallow $remove($2,$chr(58))
bod.window.remove @messages $remove($2,$chr(58))
}
.Decline query :{
kdecline $remove($2,$chr(58))
bod.window.remove @messages $remove($2,$chr(58))
}
-
Decline ALL queries:{
if ($?!="Are you sure you want to decline all the queries?") {
var %x = 1
if ($line(@messages,0) >= 6) { goto bod.clearAll }
while (%x <= $line(@messages,0)) {
var %nick = $gettok($line(@messages,%x),2,32)
kdecline $remove(%nick,$chr(58))
inc %x
clear @messages
}
:bod.clearAll
unset %bodPM*
clear @messages
}
}
Clear:{
if ($?!="Are you sure you want to clear all messages?") {
var %c = 1
if ($line(@messages,0) >= 6) { goto bod.clearAll }
while (%c <= $line(@messages,0)) {
var %nick = $gettok($line(@messages,%c),2,32)
clear @messages
inc %c
}
:bod.clearAll
unset %bodPM*
clear @messages
}
}
}