8856ba2703a6dd1ad6ae92c5148881d795ea0b3d
[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               RTT Count Int.  Ping Iso? In  Out PC92? Address";
20
21 foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all_nodes ) {
22         my $call = $dxchan->call();
23         next if $dxchan == $main::me;
24         my $t = cldatetime($dxchan->startt);
25         my $sort;
26         my $name = $dxchan->user->name || " ";
27         my $obscount = $dxchan->nopings;
28         my $pingint = $dxchan->pingint;
29         my $lastt = $dxchan->lastping ? ($dxchan->pingint - ($nowt - $dxchan->lastping)) : $pingint;
30         my $ping = $dxchan->is_node && $dxchan != $main::me ? sprintf("%8.2f",$dxchan->pingave) : "";
31         my $iso = $dxchan->isolate ? 'Y' :' ';
32         my ($fin, $fout, $pc92) = (' ', ' ', ' ');
33         if ($dxchan->do_pc9x) {
34                 $pc92 = 'Y';
35         } else {
36                 my $f;
37                 if ($f = $dxchan->inroutefilter) {
38                         $fin = $dxchan->inroutefilter =~ /node_default/ ? 'D' : 'Y';
39                 }
40                 if ($f = $dxchan->routefilter) {
41                         $fout = $dxchan->routefilter =~ /node_default/ ? 'D' : 'Y';
42                 }
43         }
44         unless ($pingint) {
45                 $lastt = 0;
46                 $ping = "        ";
47         }
48
49         $sort = 'ANEA' if $dxchan->is_aranea;
50         $sort = "DXSP" if $dxchan->is_spider;
51         $sort = "CLX " if $dxchan->is_clx;
52         $sort = "DXNT" if $dxchan->is_dxnet;
53         $sort = "AR-C" if $dxchan->is_arcluster;
54         $sort = "AK1A" if $dxchan->is_ak1a;
55         my $ipaddr;
56
57         if ($dxchan->conn->peerhost) {
58                 my $addr = $dxchan->conn->peerhost;
59                 $ipaddr = $addr if is_ipaddr($addr);
60                 $ipaddr = 'local' if $addr =~ /^127\./ || $addr =~ /^::[0-9a-f]+$/;
61         }
62         $ipaddr = 'ax25' if $dxchan->conn->ax25;
63
64         push @out, sprintf "%10s $sort $t$ping   $obscount  %5d %5d  $iso    $fin   $fout   $pc92    $ipaddr", $call, $pingint, $lastt;
65 }
66
67 return (1, @out)
68
69
70
71