b068c586aa38a381d930c04253d665966763c687
[spider.git] / cmd / who.pl
1 #\r
2 # who : is online\r
3 # a complete list of stations connected\r
4 #\r
5 # Copyright (c) 1999 Dirk Koopman G1TLH\r
6 #\r
7 #\r
8 \r
9 \r
10 my $self = shift;\r
11 my $dxchan;\r
12 my @out;\r
13 \r
14 push @out, "  Callsign Type      Started           Name     Ave RTT Link";\r
15 \r
16 foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all ) {\r
17     my $call = $dxchan->call();\r
18         my $t = cldatetime($dxchan->startt);\r
19         my $type = $dxchan->is_node ? "NODE" : "USER";\r
20         my $sort = "    ";\r
21         if ($dxchan->is_node) {\r
22                 $sort = 'ANEA' if $dxchan->is_aranea;\r
23                 $sort = "DXSP" if $dxchan->is_spider;\r
24                 $sort = "CLX " if $dxchan->is_clx;\r
25                 $sort = "DXNT" if $dxchan->is_dxnet;\r
26                 $sort = "AR-C" if $dxchan->is_arcluster;\r
27                 $sort = "AK1A" if $dxchan->is_ak1a;\r
28         }\r
29         my $name = $dxchan->user->name || " ";\r
30         my $ping = $dxchan->is_node && $dxchan != $main::me ? sprintf("%5.2f", $dxchan->pingave) : "     ";\r
31         my $conn = $dxchan->conn;\r
32         my $ip = '';\r
33         if ($conn) {\r
34                 $ip = $conn->{peerhost} if exists $conn->{peerhost};\r
35                 $ip = "AGW Port ($conn->{agwport})" if exists $conn->{agwport};\r
36         }\r
37         push @out, sprintf "%10s $type $sort $t %-10.10s $ping $ip", $call, $name;\r
38 }\r
39 \r
40 return (1, @out)\r