dialog ctcp.admin {
title "CTCP Admin"
size -1 -1 400 205
option pixels
text "Address List:", 1, 10 8 65 14
list 2, 10 25 308 88, size
check "Enable", 3, 10 163 80 17
check "Away only", 4, 10 183 81 17
button "Remove", 5, 323 55 65 25
button "Edit", 6, 323 85 65 25
button "OK", 7, 253 175 65 25, ok
button "Cancel", 8, 323 175 65 25, cancel
text "By giving people ctcp access they get full control over your client, and can use all commands. It's also possible to turn on the away only function, that allows access only when your away.", 10, 10 118 381 42
button "Add", 9, 323 25 65 25
}
on *:dialog:ctcp.admin:init:*: {
if (%ctcp.admin == on) did -c $dname 3
if (%ctcp.admin.only == on) did -c $dname 4
var %i = $ulist(*,2,0)
var %c = 1
while (%c <= %i) {
did -a $dname 2 $ulist(*,2,%c)
inc %c
}
}
on *:dialog:ctcp.admin:sclick:*: {
if ($did(3).state == 1) { set %ctcp.admin on } | else { set %ctcp.admin off }
if ($did(4).state == 1) { set %ctcp.admin.only on } | else { set %ctcp.admin.only off }
if (($did == 5) && ($did($dname,2).sel != $null)) {
.ruser $did($dname,2).seltext
did -d $dname 2 $did($dname,2).sel
}
elseif (($did == 6) && ($did($dname,2).sel != $null)) {
var %newaddress = $$input(Edit address:, e, , $did($dname,2).seltext)
if (%newaddress == $null) { halt }
.ruser $did($dname,2).seltext
.auser 2 %newaddress
did -o $dname 2 $did($dname,2).sel %newaddress
}
elseif (($did == 9) && ($did($dname,2).sel != $null)) {
var %newaddress = $$input(Add address:, e, , $did($dname,2).seltext)
if (%newaddress == $null) { halt }
.auser 2 %newaddress
did -o $dname 2 $did($dname,2).sel %newaddress
}
}