rendered paste body;Dialog
dialog LDlist {
title "Lists [WiseScript]"
size -1 -1 95 175
option dbu
tab "Friend", 1, 2 2 90 170
button "Delete Selected", 4, 5 113 85 12, tab 1
list 3, 5 18 85 94, tab 1 size vsbar
text "Add new nick", 5, 5 127 85 8, tab 1 center
text "Rank Label:", 6, 5 148 29 10, disable tab 1
edit "Friend", 7, 35 147 55 10, tab 1
text "Nick:", 8, 5 137 29 8, disable tab 1
edit "", 9, 35 136 55 10, tab 1
button "Add nick", 10, 5 158 85 12, tab 1
tab "Black", 2
list 11, 5 18 85 94, tab 2 size vsbar
button "Delete Selected", 12, 5 113 85 12, tab 2
text "Add new", 13, 5 127 85 8, tab 2 center
text "Nick/Host:", 14, 5 148 29 10, disable tab 2
edit "", 15, 35 147 55 10, tab 2
radio "Nick", 16, 5 136 22 10, tab 2
radio "Host", 17, 30 136 23 10, tab 2
button "Add", 18, 5 158 85 12, tab 2
tab "Exeptions", 19
list 20, 5 18 85 94, tab 19 size vsbar
button "Delete Selected", 21, 5 113 85 12, tab 19
text "Add new channel", 22, 5 127 85 8, tab 19 center
text "Channel:", 23, 5 137 29 8, disable tab 19
edit "", 24, 35 136 55 10, tab 19
button "Add channel", 27, 5 158 85 12, tab 19
}
; Events
on *:dialog:LDlist:init:*: {
LD.UpdateLists
}
on *:dialog:LDlist:sclick:27: {
var %x $did(LDlist,24)
writeini $LD.File Exeption $ini.encode(%x) Nada
LD.UpdateLists
}
on *:dialog:LDlist:sclick:10: {
var %x $did(LDlist,9)
var %y $did(LDlist,7)
writeini $LD.File Friend $Ini.encode(%x) $Ini.encode(%y)
LD.UpdateLists
}
on *:dialog:LDlist:sclick:18: {
var %x $did(LDlist,15)
var %y $did(LDlist,16).state
writeini $LD.File Black $Ini.encode(%x) $iif(%y == 1,Nick,Host)
LD.UpdateLists
}
on *:dialog:LDlist:sclick:4: { ; Friend List delete button
var %x $did(LDlist,$LD.FriendList).sel
if (%x == 0) noop $input(Nothing selected,ow,Error)
else {
remini $LD.File Friend $ini.encode($did(LDlist,$LD.FriendList,%x))
LD.UpdateLists
}
}
on *:dialog:LDlist:sclick:12: { ; Black List delete button
var %x $did(LDlist,$LD.BlackList).sel
if (%x == 0) noop $input(Nothing selected,ow,Error)
else {
remini $LD.File Black $ini.encode($did(LDlist,$LD.BlackList,%x))
LD.UpdateLists
}
}
on *:dialog:LDlist:sclick:21: { ; Exeption List delete button
var %x $did(LDlist,$LD.ExeptionList).sel
if (%x == 0) noop $input(Nothing selected,ow,Error)
else {
remini $LD.File Exeption $ini.encode($did(LDlist,$LD.ExeptionList,%x))
LD.UpdateLists
}
}
on *:join:#: {
if (!$readini($LD.File,Exeptions,$Ini.encode($chan))) { ; Checking if the channel is on the exeption list
if ($readini($LD.File,Friend,$Ini.encode($nick))) {
msg # Hi $nick $+ , you are on my $Ini.decode($v1) list! [WiseScript]
}
if ($readini($LD.File,Black,$ini.encode($nick)) == nick) || ($LD.IsBlackHost($nick)) {
ban -k # $nick 2 Blacklist. Cya!
}
}
}
; Aliases
alias LD.IsBlackHost {
var %x 1
var %y $address($1,5)
while ($ini($LD.File,Black,%x)) {
if ($readini($LD.File,Black,$v1) == Host) && ($ini($LD.File,Black,%x) iswm %y) { return $true | break | var %z True }
inc %x
}
if (!%z) { return $false }
}
alias LD.File { return LDLists.ini }
alias LD.ExeptionList { return 20 }
alias LD.BlackList { return 11 }
alias LD.FriendList { return 3 }
alias LD.Dialog { dialog -m LDlist LDlist } ; Opening the dialog
alias LD.UpdateLists { ; Updating the dialog lists
;Updating Friend List
did -r LDlist $LD.FriendList
var %x 1
while ($ini($LD.File,Friend,%x)) {
did -a LDlist $LD.FriendList $Ini.decode($v1)
inc %x
}
;Updating Black List
did -r LDlist $LD.BlackList
var %x 1
while ($ini($LD.File,Black,%x)) {
did -a LDlist $LD.BlackList $ini.decode($v1)
inc %x
}
;Updating Exeptions List
did -r LDlist $LD.ExeptionList
var %x 1
while ($ini($LD.File,Exeption,%x)) {
did -a LDlist $LD.ExeptionList $ini.decode($v1)
inc %x
}
}
alias Ini.encode { return $replace($1-,[,$encode([),],$encode(])) }
alias Ini.decode { return $replace($1-,$encode([),[,$encode(]),]) }