fix sh/mydx, add back qra sq for sh/dxgrid
[spider.git] / cmd / links.pl
1 #
2 # links : which are active
3 # a complete list of currently connected linked nodes
4 #
5 # Created by Iain Philipps G0RDI, based entirely on
6 # who.pl, which is Copyright (c) 1999 Dirk Koopman G1TLH
7 # and subsequently plagerized by K1XX.
8 #
9 # 16-Jun-2000
10 #
11 #
12
13 my $self = shift;
14 my $dxchan;
15 my @out;
16 my $nowt = time;
17
18 push @out, "                                                  Ave  Obs  Ping  Next      Filters";
19 push @out, "  Callsign Type Started                 Uptime    RTT Count Int.  Ping Iso? In  Out PC92? Address";
20
21 foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all ) {
22         next if $dxchan == $main::me;
23         next unless $dxchan->is_node || $dxchan->is_rbn;
24         my $call = $dxchan->call();
25         my $t = cldatetime($dxchan->startt);
26         my $sort;
27         my $name = $dxchan->user->name || " ";
28         my $obscount = $dxchan->nopings;
29         my $pingint = $dxchan->pingint;
30         my $lastt = $dxchan->lastping ? ($dxchan->pingint - ($nowt - $dxchan->lastping)) : $pingint;
31         my $ping = $dxchan->is_node && $dxchan != $main::me ? sprintf("%7.2f",$dxchan->pingave) : "";
32         my $iso = $dxchan->isolate ? 'Y' : ' ';
33         my $uptime = difft($dxchan->startt, 1);
34         my ($fin, $fout, $pc92) = (' ', ' ', ' ');
35         if ($dxchan->do_pc9x) {
36                 $pc92 = 'Y';
37         } else {
38                 my $f;
39                 if ($f = $dxchan->inroutefilter) {
40                         $fin = $dxchan->inroutefilter =~ /node_default/ ? 'D' : 'Y';
41                 }
42                 if ($f = $dxchan->routefilter) {
43                         $fout = $dxchan->routefilter =~ /node_default/ ? 'D' : 'Y';
44                 }
45         }
46         unless ($pingint) {
47                 $lastt = 0;
48                 $ping = "        ";
49         }
50
51         $sort = "DXSP" if $dxchan->is_spider;
52         $sort = "CLX " if $dxchan->is_clx;
53         $sort = "DXNT" if $dxchan->is_dxnet;
54         $sort = "AR-C" if $dxchan->is_arcluster;
55         $sort = "AK1A" if $dxchan->is_ak1a;
56         $sort = "RBN " if $dxchan->is_rbn;
57         my $ipaddr;
58
59         my $addr = $dxchan->hostname;
60         if ($addr) {
61             $ipaddr = $addr if is_ipaddr($addr);
62                 $ipaddr = 'local' if $addr =~ /^127\./ || $addr =~ /^::[0-9a-f]+$/;
63         }
64         $ipaddr = 'ax25' if $dxchan->conn->ax25;
65
66         push @out, sprintf "%10s $sort $t%13s$ping   $obscount  %5d %5d  $iso    $fin   $fout   $pc92    $ipaddr", $call, $uptime ,$pingint, $lastt;
67 }
68
69 return (1, @out)
70
71
72
73