menu status {
Connect to...
.Recent networks
..$submenu($_rec_netw($1))
.Popular networks
..$submenu($_pop_netw($1))
}
; return popular networks from servers.ini
alias -l _pop_netw {
if ($istok(begin end,$1,32)) return -
return $iif($istok($_connected_networks,$readini(servers.ini,networks,$(n $+ $calc($1 - 1),2)),32),$style(3)) $readini(servers.ini,networks,$(n $+ $calc($1 - 1),2)) : server $iif($server,-m) $readini(servers.ini,networks,$(n $+ $calc($1 - 1),2))
}
; return recent successful networks from servers.ini
alias -l _rec_netw {
if ($istok(begin end,$1,32)) return -
noop $regex($readini(servers.ini,recent,$(n $+ $calc($1 - 1),2)),/.*SERVER:[^:]+:(\+?\d+)GROUP:([^:]+)/) | var %port $regml(1), %net $regml(2)
return $iif($istok($_connected_networks,%net,32),$style(3)) %net %port : server $iif($server,-m) %net %port
}
; return list of connected network names, space delimited
alias -l _connected_networks {
var %s 1, %res
while ($scon(%s)) {
if ($scon(%s).server) var %res $addtok(%res,$scon(%s).network,32)
inc %s
}
return %res
}
; return list of connected server names, space delimited
alias -l _connected_servers {
var %s 1, %res
while ($scon(%s)) {
if ($scon(%s).server) var %res $addtok(%res,$scon(%s).server,32)
inc %s
}
return %res
}