This script is the first time I used dialogs in a script. It checks when users join and when they change nicks, using ONLY the userlevels list, to make it faster.
I initially had just an 'add' dialog for simplicity, but then I decided to expand it into a blacklist manager where you can click on a blacklist in the left panel and edit it instantly in the right panel, with multiple delete functions and the ability to choose whether or not to search all rooms for matches upon closing.
The intention of this script was to create a blacklist script unlike others (I haven't seen them all, so I can't say it has never been done like this before). I was not inclined to post this one, but I decided to put it up for you all anyway. :)
Also, the save button won't appear unless both boxes are filled and the banmask matches !@* but doesn't equal it.
You can use /blist or the right-click menu to open the dialog.
Put this in your remotes (alt+r) in a new file (File->New).
I personally like this blacklist, and hope you do too. :)
--- All credit goes to Gummo ---
UPDATES!
16/10/07: - Added option to auto-unban after 12 hours.
dialog -l blist {
title "Blacklist Manager - Made by Gummo"
size -1 -1 324 144
option dbu
check "&Enable Blacklist", 1, 8 8 52 10
list 2, 8 24 161 109, size extsel
box "Blacklist Info", 3, 176 8 141 113
text "Banmask:", 4, 184 20 25 8
edit "", 5, 184 31 125 10, autohs
text "Reason for Blacklist:", 6, 184 48 50 8
edit "", 7, 184 60 125 10, autohs
text "Date Added/Modified:", 8, 184 76 55 8
edit "", 9, 184 88 125 10, read
button "&New", 10, 184 104 37 12
button "&Save", 11, 228 104 37 12
button "&Delete", 12, 272 104 37 12
check "Chec&k on Close", 13, 188 128 50 10
button "&Close", 14, 244 128 37 12, ok
check "Auto-Unban After 12 Hours", 15, 92 8 75 10
}
on *:dialog:blist:init:0: {
if ($group(#blist) == on) {
did -c blist 1
did -e blist 15
}
if ($group(#blist) != on) {
did -u blist 1
did -b blist 15
}
did -u blist 13
did -r blist 2,5,7,9
did -b blist 5,7,9,11,12
if ($group(#blist.unban) == on) did -c blist 15
if ($group(#blist.unban) != on) did -u blist 15
var %c 1
while (%c <= $ulist(*,blist,0)) {
did -a blist 2 $ulist(*,blist,%c)
inc %c
}
did -f blist 2
}
on *:dialog:blist:sclick:1: {
if ($did(blist,1).state != 1) did -b blist 15
if ($did(blist,1).state == 1) did -e blist 15
}
on *:dialog:blist:sclick:2: {
did -e blist 10,12
if ($did(blist,2,0).sel == 1) {
did -e blist 5,7,9
did -b blist 11
set %blist.num $did(blist,2,1).sel
did -ra blist 5 $ulist(*,blist,%blist.num)
did -ra blist 7 $gettok($ulist(*,blist,%blist.num).info,6-,32)
did -ra blist 9 $gettok($ulist(*,blist,%blist.num).info,1-5,32)
}
if ($did(blist,2,0).sel > 1) {
unset %blist.num
did -rb blist 5,7,9
}
}
on *:dialog:blist:edit:5,7: {
did -ra blist 9 $asctime
if (!$regex($did(blist,5).text,/^\S+!\S+@\S+/Si)) || (!$regex($did(blist,7).text,/^.*\S.*$/Si)) || (*!*@* == $did(blist,5).text) did -b blist 11
if ($regex($did(blist,5).text,/^\S+!\S+@\S+/Si)) && ($regex($did(blist,7).text,/^.*\S.*$/Si)) && (*!*@* != $did(blist,5).text) did -e blist 11
}
on *:dialog:blist:sclick:10: {
unset %blist.num
did -re blist 5,7,9
did -b blist 11,12
did -f blist 5
}
on *:dialog:blist:sclick:11: {
if (%blist.num) .ruser blist $ulist(*,blist,%blist.num)
.auser -a blist $gettok($did(blist,5).text,1,32) $asctime $did(blist,7).text
did -r blist 2,5,7,9
did -b blist 5,7,9,11,12
did -c blist 13
var %c 1
while (%c <= $ulist(*,blist,0)) {
did -a blist 2 $ulist(*,blist,%c)
inc %c
}
did -f blist 14
}
on *:dialog:blist:sclick:12: {
if ($did(blist,2,0).sel == 1) {
.ruser blist $ulist(*,blist,%blist.num)
did -f blist 2
}
if ($did(blist,2,0).sel > 1) {
var %b 1
while ($did(blist,2,%b).sel) {
.ruser blist $did(blist,2,$did(blist,2,%b).sel).text
inc %b
}
}
did -r blist 2,5,7,9
did -b blist 5,7,9,11,12
var %c 1
while ($ulist(*,blist,%c)) {
did -a blist 2 $ulist(*,blist,%c)
inc %c
}
}
on *:dialog:blist:close:0: {
unset %blist.num
.timerblistsmiley off
if ($did(blist,1).state != 1) .disable #blist
if ($did(blist,1).state == 1) .enable #blist
if ($did(blist,15).state != 1) .disable #blist.unban
if ($did(blist,15).state == 1) .enable #blist.unban
if ($did(blist,13).state == 1) && ($group(#blist) == on) blkick
}
menu * {
-
Modify Blacklist:blist
-
}
alias -l blist {
unset %blist.num
dialog -amo blist blist
}
alias -l blist.unban {
if ($group(#blist.unban) == on) return -u43200
}
#blist.unban on
; Do not remove this group. It serves as a permanent variable.
#blist.unban end
#blist on
alias blkick {
var %a 1
while ($chan(%a)) {
var %c 1
while ($ulist(*,blist,%c)) {
var %b 1
while ($ialchan($ulist(*,blist,%c),$chan(%a),%b).nick) {
if ($ialchan($ulist(*,blist,%c),$chan(%a),%b).nick != $me) {
ban $blist.unban $chan(%a) $ulist(*,blist,%c)
kick $chan(%a) $ialchan($ulist(*,blist,%c),$chan(%a),%b).nick Blacklisted - $gettok($ulist(*,blist,%c).info,6-,32)
}
inc %b
}
inc %c
}
inc %a
}
}
on blist:join:#: {
if ($ulist($fulladdress,blist)) {
ban $blist.unban $chan $ulist($fulladdress,blist,1)
kick $chan $nick Blacklisted - $gettok($ulist($fulladdress,blist,1).info,6-,32)
}
}
on *:nick: {
if ($newnick != $me) && ($ulist($ial($newnick,1),blist)) {
var %a 1
while ($comchan($newnick,%a)) {
ban $blist.unban $comchan($newnick,%a) $ulist($ial($newnick,1),blist,1)
kick $comchan($newnick,%a) $newnick Blacklisted - $gettok($ulist($ial($newnick,1),blist,1).info,6-,32)
inc %a
}
}
}
#blist end
Alright, when I update this I\'ll include a menu. I found it easier to use f7 as I decide what buttons are for what, but I\'ll change that so you can choose whether or not to enable them. Also, there already is a checkbox in the dialog for turning it on/off.
On a side note, this site doesn\'t seem to appreciate the backslashes used in my regex.. It only works with them some of the time.
The only asthetic thing I cna thin of is it is a little wide. Perhaps have buttons that make it change shape when you choose to view the black list. Ex: Click button \" View List \" and the dialog changes shape to show the list. Then click a button \" Close List \" and the dialog goes back to the original shape.
While that\'s true, the owner of the room may actually want that person to stay, removing your access because the blacklist kicks them and then replacing theirs.
That would be where the exlusion of rooms would be handy for individual bans. ;)
Also, if they\'re being a pain your could remove their access manually. Many servers don\'t have chanserv.