fix probelm writing to wrong type of filehandle in genstats
[spider.git] / cmd / who.pl
index d001d9c3efde80d71364dd02fec30a114293a877..ecb45d70f8eff3167934e57522cd62c078f4b05d 100644 (file)
@@ -11,14 +11,26 @@ my $self = shift;
 my $dxchan;
 my @out;
 
-push @out, "  Callsign Type Started           Name";
+push @out, "  Callsign Type      Started           Name     Ave RTT Link";
 
 foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all ) {
     my $call = $dxchan->call();
-       my $t = cldatetime($dxchan->user->lastin);
-       my $sort = $dxchan->is_ak1a() ? "NODE" : "USER";
+       my $t = cldatetime($dxchan->startt);
+       my $type = $dxchan->is_node ? "NODE" : "USER";
+       my $sort = "    ";
+       if ($dxchan->is_node) {
+               $sort = "DXSP" if $dxchan->is_spider;
+               $sort = "CLX " if $dxchan->is_clx;
+               $sort = "DXNT" if $dxchan->is_dxnet;
+               $sort = "AR-C" if $dxchan->is_arcluster;
+               $sort = "AK1A" if $dxchan->is_ak1a;
+       }
        my $name = $dxchan->user->name || " ";
-       push @out, sprintf "%10s $sort $t $name", $call;
+       my $ping = $dxchan->is_node && $dxchan != $DXProt::me ? sprintf("%5.2f", $dxchan->pingave) : "     ";
+       my $conn = $dxchan->conn;
+       my $ip = '';
+       $ip = $conn->{peerhost} if $conn && $conn->{peerhost};
+       push @out, sprintf "%10s $type $sort $t %-10.10s $ping $ip", $call, $name;
 }
 
 return (1, @out)