Public feed
#726103
dialog blk {
title "Blacklist"
size -1 -1 229 105
option dbu
list 1, 2 2 183 101, size
button "Global Ban", 3, 188 61 37 12
button "Ok", 4, 193 85 27 12, ok
button "Add", 5, 188 19 37 12
button "Remove", 6, 188 31 37 12
button "Edit", 7, 188 43 37 12
check "Enable", 8, 193 4 25 10
}
on *:DIALOG:blk:init:*:{
if ($readini(blacklist.ini,-n,set,e)) { did -c blk 8 }
var %x = 1
while ($ini(blacklist.ini,bans,%x)) {
did -a blk 1 $ifmatch
inc %x
}
}
on *:DIALOG:blk:close:*:{ writeini blacklist.ini set e $did(8).state }
on *:DIALOG:blk:sclick:3:{
if ($did(1).seltext) {
var %x = 1
while (%x <= $chan(0)) {
if ($me isop $chan(%x) || $me ishop $chan(%x)) {
msg $chan(%x) [7Global Ban] I have global banned:7 $did(1).seltext • Reason:7 $gettok($readini(blacklist.ini,-n,bans,$did(1).seltext),2-,32)
mode $chan(%x) +b $did(1).seltext
var %c = 1
while (%c <= $nick($chan(%x),0)) {
if ($address($nick($chan(%x),%c),2) == $did(1).seltext || $nick($chan(%x),%c) == $did(1)seltext) { kick $chan(%x) $nick($chan(%x),%c) Blacklist Matched $iif(*!* iswm $did(1).seltext,Address,Nickname) • Reason: $gettok($readini(blacklist.ini,-n,bans,$did(1).seltext),2-,32) }
inc %c
}
}
inc %x
}
}
else {
var %b = $$?="Host", %r = $$?="Reason", %x = 1
if (!%b || !%r) { halt }
while (%x <= $chan(0)) {
if ($me isop $chan(%x) || $me ishop $chan(%x)) {
msg $chan(%x) [7Global Ban] I have global banned:7 %b • Reason:7 %r
mode $chan +b %b
}
inc %x
}
}
}
on *:DIALOG:blk:sclick:5:{ dialog -ma blke blke }
on *:DIALOG:blk:sclick:6:{
if ($did(blk,1).seltext) {
remini blacklist.ini bans $did(1).seltext
did -d blk 1 $did(1).sel
}
}
on *:DIALOG:blk:sclick:7:{
if ($did(1).seltext) {
set %blk.edit $ifmatch
dialog -ma blke blke
}
}
dialog blke {
title "Blacklist"
size -1 -1 116 73
option dbu
check "Enable", 1, 4 2 26 10
box "*!*@Host/Nickname", 2, 1 13 113 21
edit "", 3, 4 21 108 10, autohs
box "Reason", 4, 1 36 113 21
edit "", 5, 4 44 108 10, autohs
button "Ok", 6, 3 59 25 12, ok
button "Cancel", 7, 31 59 25 12, cancel
}
on *:DIALOG:blke:init:*:{
if (%blk.edit) {
tokenize 32 $readini(blacklist.ini,-n,bans,$ifmatch)
did -a blke 3 $ifmatch
if ($1) { did -c blke 1 }
did -a blke 5 $2-
}
}
on *:DIALOG:blke:sclick:6:{
if ($did(blke,3)) {
if (%blk.edit) {
remini blacklist.ini bans %blk.edit
did -d blk 1 $did(blk,1).sel
did -a blk 1 $did(3)
}
writeini blacklist.ini bans $did(3) $did(1).state $iif($did(5),$ifmatch,No Reason)
if (!%blk.edit) { did -a blk 1 $did(3) }
unset %blk.edit
if ($did(1).state) {
var %x = 1
while (%x <= $chan(0)) {
if ($me isop $chan(%x) || $me ishop $chan(%x)) {
mode $chan(%x) +b $did(3)
msg $chan(%x) [7Blacklist] I have added:7 $did(3) • Reason:7 $iif($did(5),$ifmatch,No Reason)
var %c = 1
while (%c <= $nick($chan(%x),0)) {
if ($address($nick($chan(%x),%c),2) == $did(3) || $nick($chan(%x),%c) == $did(3)) { kick $chan(%x) $nick($chan(%x),%c) Blacklist Matched $iif(*!* iswm $did(3),Address,Nickname) • Reason: $iif($did(5),$ifmatch,No Reason) }
inc %c
}
}
inc %x
}
}
}
}
on *:DIALOG:blke:sclick:7:{ unset %blk.edit }
on *:DIALOG:blke:close:*:{ unset %blk.edit }
on *:JOIN:#:{
if ($nick == $me) { .timer 1 2 /check.list $chan }
else {
if ($readini(blacklist.ini,-n,bans,$wildsite) || $readini(blacklist.ini,-n,bans,$nick)) {
tokenize 32 $ifmatch
if ($1 && $readini(blacklist.ini,-n,set,e)) && ($me isop $chan || $me ishop $chan) {
noop $tip(BL,Blacklist Matched $iif($readini(blacklist.ini,-n,bans,$wildsite),Address,Nickname),$nick ( $+ $address($nick,2) $+ ) $+ $crlf $+ $chan $+ $crlf $+ $2-,60,,,,)
ban -k $chan $nick 2 Blacklist Matched $iif($readini(blacklist.ini,-n,bans,$wildsite),Address,Nickname) • Reason: $2-
}
}
}
}
alias /check.list {
var %x = 1, %c = $1
while (%x <= $nick($1,0)) {
if ($readini(blacklist.ini,-n,bans,$address($nick($1,%x),2)) || $readini(blacklist.ini,-n,bans,$nick($1,%x))) {
tokenize 32 $ifmatch
if ($1 && $readini(blacklist.ini,-n,set,e)) && ($me isop %c || $me ishop %c) {
noop $tip(BL,Blacklist Matched $iif($readini(blacklist.ini,-n,bans,$address($nick(%c,%x),2)),Address,Nickname),$nick(%c,%x) ( $+ $address($nick(%c,%x),2) $+ ) $+ $crlf $+ %c $+ $crlf $+ $2-,60,,,,)
ban -k %c $nick(%c,%x) 2 Blacklist Matched $iif($readini(blacklist.ini,-n,bans,$address($nick(%c,%x),2)),Address,Nickname) • Reason: $2
}
}
inc %x
}
}