Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias sdt {
- if ($did($did).state) { set % $+ $1 1 }
- else { unset % $+ $1 }
- }
- alias _hmake {
- if ($hget($1)) { hfree $1 }
- hmake $1-
- }
- alias _txtdir { return $+($scriptdir,txt\,$1) }
- alias netsel.load {
- if ($ini(servers.ini,servers,0)) {
- window -h @loadnets
- _hmake servtmp
- loadbuf -tservers @loadnets servers.ini
- var %i = $line(@loadnets,0), %nd = $token(%autoperform,0,32)
- while (%i) {
- if ($regex(loadnet,$line(@loadnets,%i),/^n\d+=.+SERVER:.+GROUP:([^:]+)/i)) && ($regml(loadnet,1) !isnum) && (!$hget(servtmp,$v1)) {
- var %t = $regml(loadnet,1), %nn = %autoperform
- if (!$istok(%nn,%t,32)) { did -a $dname 1 %t }
- hadd servtmp $regml(loadnet,1) 1
- }
- dec %i
- }
- hfree servtmp
- close -@ @loadnets
- }
- }
- alias perforead {
- var %line,%f $_txtdir(perform.txt),%l $lines(%f)
- if ($read(%f,tnw,[[ $+ %previousnet $+ ]])) {
- var %line $readn + 1
- while (%line <= %l) {
- var %r $read(%f,tn,%line)
- if (!$regex(%r,/^\[[^\]\[]+\]$/)) && ($readn <= %l) {
- write -dl %line $qt(%f)
- dec %l
- }
- else { break }
- }
- }
- if ($didtok($dname,11,10).text == $null) {
- if (%line) write -dl $calc(%line -1) $qt(%f)
- }
- else {
- if (%line) { write -il $v1 $qt(%f) $didtok($dname,11,10).text }
- else { write $qt(%f) [[ $+ %previousnet $+ ]] $+ $crlf $+ $didtok($dname,11,10).text }
- }
- }
- dialog netsel {
- title "Add network"
- size -1 -1 212 203
- list 1, 6 21 118 177, sort size vsbar
- button "&OK", 2, 131 144 76 23, ok
- button "&Cancel", 3, 131 172 76 23, cancel
- text "Select network:", 4, 8 5 82 14
- }
- on *:dialog:netsel:*:*:{
- if ($devent == init) { netsel.load }
- elseif ($devent == sclick) {
- if ($did == 2) && ($did(1).seltext) { set %netsel.result $did(1).seltext }
- }
- elseif ($devent == dclick) && ($did == 1) {
- set %netsel.result $did(1).seltext
- dialog -c $dname
- }
- }
- alias perform { dialog -m perform perform }
- dialog perform {
- title "Perform"
- size -1 -1 293 320
- check "E&nable perform on connect", 1, 10 15 155 14
- text "Perform commands:", 2, 10 115 120 14
- text "Network:", 3, 10 45 120 14
- combo 4, 8 61 136 160, size sort drop
- edit "", 11, 8 132 277 147, multi return hsbar vsbar
- button "&Add", 14, 150 61 76 23
- button "&Delete", 15, 150 90 76 23
- button "&OK", 12, 128 289 76 23, ok
- button "&Cancel", 13, 210 289 76 23, cancel
- }
- on *:dialog:perform:*:*:{
- if ($devent == init) {
- if (%perform.net) { did -c $dname 1 }
- if (%autoperform == $null) { did -ca $dname 4 All Networks | set %previousnet perform }
- else {
- didtok $dname 4 32 %autoperform
- did -c $dname 4 1
- set %previousnet $did(4).seltext
- }
- var %f = $_txtdir(perform.txt)
- if ($read(%f,tnw,[[ $+ %previousnet $+ ]])) loadbuf -ot $+ %previousnet $dname 11 %f
- }
- elseif ($devent == sclick) {
- if ($did == 1) { sdt perform.net }
- elseif ($did == 4) {
- perforead
- var %f $_txtdir(perform.txt)
- did -r $dname 11
- if (%autoperform != $null) { set %previousnet $did(4).seltext }
- if ($read(%f,tnw,[[ $+ %previousnet $+ ]])) loadbuf -ot $+ %previousnet perform 11 $_txtdir(perform.txt)
- }
- elseif ($did == 12) { perforead }
- elseif ($did == 14) {
- perforead
- noop $dialog(netsel,netsel,-4)
- if (%netsel.result) {
- if (%autoperform == $null) { did -d perform 4 1 }
- set %autoperform $addtok(%autoperform,%netsel.result,32)
- did -r $dname 11
- did -ca $dname 4 %netsel.result
- set %previousnet %netsel.result
- unset %netsel.result
- }
- }
- elseif ($did == 15) {
- did -r $dname 4,11
- perforead
- if (%autoperform) {
- var %c $_txtdir(perform.txt)
- set %autoperform $remtok(%autoperform,%previousnet,32)
- didtok $dname 4 32 %autoperform
- did -c $dname 4 1
- set %previousnet $did(4).seltext
- if ($read(%c,tnw,[[ $+ %previousnet $+ ]])) loadbuf -ot $+ %previousnet perform 11 %c
- }
- if (%autoperform == $null) {
- did -ca $dname 4 All Networks
- set %previousnet perform
- }
- }
- }
- elseif ($devent == close) { unset %previousnet }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement