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