my first dialog using Dialog Editor :D
load into remotes and type blist to load it
if a nick joins a chan that you are op or halfop in you'll kickban them
menu channel {
Black List:blist
}
dialog Blist {
title "Black List"
size -1 -1 207 114
option dbu
box "Config", 1, 0 0 206 114
list 2, 8 16 84 95
box "Black List", 3, 6 8 88 104
box "Options", 4, 99 8 106 104
box "Add/Del", 5, 103 16 98 52
box "Power", 6, 102 89 94 19
radio "On", 7, 118 95 22 10, group
radio "Off", 8, 148 96 22 9
edit "", 10, 145 25 43 10,autohs autovs
button "Add", 11, 111 25 28 10
button "Del", 12, 111 40 28 10
button "Clear", 13, 152 40 27 10
box "Reason", 14, 102 69 91 21
edit "", 15, 107 76 80 10, autohs autovs multi
radio "Black List Nick", 9, 105 55 43 8, group
radio "Black List Address", 16, 149 55 52 8
}
on *:dialog:blist:*:*: {
if ($devent == init) { didtok $dname 2 32 $blist.list | did -c $dname $+($iif(%blist.power == on,7,8),$chr(44),$iif(%blist.ban == nick,9,16)) | did -b $dname 11,12 | if ($hget(blist,0).item == 0) did -b $dname 13 }
elseif ($devent == sclick) {
if ($did == 2) { did -ra $dname 10 $did(2).seltext | did -ra $dname 15 $hget(blist,$did(2).seltext) | did -e $dname 12 }
elseif ($istok(7.8,$did,46)) { set %blist.power $iif($did == 7,on,off) | did -u $dname $iif($did == 7,8,7) }
elseif ($istok(9.16,$did,46)) { set %blist.ban $iif($did == 9,nick,address) | did -u $dname $iif($did == 9,16,9) }
elseif ($did == 11) { blist.add $did(10) $did(15) | did -a $dname 2 $iif(%blist.ban == nick,$did(10),$address($did(10),2)) | did -r $dname 10,15 }
elseif ($did == 12) { blist.unban $did(2).seltext | blist.del $did(2).seltext | did -d $dname 2 $did(2).sel | did -r $dname 10,15 | if ($hget(blist,0).item == 0) did -b $dname 12,13 }
elseif ($did == 13) { blist.clear | did -r $dname 2,10,15 }
}
elseif ($devent == edit) if ($did == 10) did -e $dname 11
}
alias blist dialog $iif($dialog(blist),-v,-md) blist blist
alias -l blist.add hadd -m blist $iif($chr(46) !isin $1,$iif(%blist.ban == nick || !$ial($1),$1,$address($1,2)),$1) $iif($2,$2-,Black Listed.)
alias -l blist.del hdel blist $1
alias -l blist.clear { var %a $hget(blist,0).item | while (%a) { hdel blist $hget(blist,%a).item | dec %a } }
alias -l blist.list { var %a $hget(blist,0).item | while (%a) { var %b %b $hget(blist,%a).item | dec %a } | return %b }
alias -l blist.check { var %a 1 | while (%a <= $hget(blist,0).item) { if ($hget(blist,%a).item == $1 || $hget(blist,%a).item iswm $address($1,5)) { ban -k # $1 2 $iif($hget(blist,$1-),$v1,Black Listed.) } | inc %a } }
alias blist.unban { var %a 1 | while (%a <= $chan(0)) { if ($nick(#,$me,oh)) mode # -b $1 | inc %a } }
on @%*:join:#:if (%blist.power == on) { noop $blist.check($nick) }
on *:exit:hsave blist blist.txt
on *:unload:hsave blist blist.txt
on *:start:{ hmake blist | if $isfile(blist.txt) hload blist blist.txt | set %blist.ban nick }
@Spanky its my first time using Dialog Editor to amke a dialog not my first dialog :p
@WorldDMT thnx :p altho i dont really see the difference between using $istok and $regex?
updated it a lil bit option of Banning address or nick but if you choose ban address make sure that their address is in ur $ial otherwise it wont work, if its not in your $ial and you still want to ban the address choose ban nick and type in the address of the nick and it will use that.
hi
nice sunslayer :)
i have a little comments
dialog $iif($dialog(blist),-v,-md blist) blist
u can use check better than radio for ON/OFF
u can replace $regex by $istok "$istok(7.8,$did,46)"
elseif $istok(7.8,$did,46) { hadd -m blist power $iif($did == 7,on,off) | did -u $dname $iif($did == 7,8,7) }
your on load event will never be $true replace it by on start and add hmake
on *:start:{ hmake blist | if $isfile(blist.txt) hload blist blist.txt }
for alias blist.check u can use a code more simple and faster like add only host to black list and replace $nick(#,$me,oh) by "@" befor level then on join event will be like this
on @*:join:#:{
if ($hget(blist,power) == on) {
if ($hget(blist,$wildsite)) ban -k $nick 2 $v1
}
}
then the hadd will be like this eg: hadd blist $address($nick,2)