]> gb7djk.dxcluster.net Git - spider.git/blob - cmd/show/station.pl
Minor changes to /spider/html/hops.html for correction of file name.
[spider.git] / cmd / show / station.pl
1 #
2 # show the station details
3 #
4 # Copyright (c) 1998 - Dirk Koopman G1TLH
5 #
6 # Modifications by Iain Philipps G0RDI, 07-Dec-1998
7 #
8
9 my ($self, $line) = @_;
10 my @f = split /\s+/, uc $line;
11 my @out;
12 my $call;
13 my $seek;
14
15 if (@f == 0) {
16         return (1, $self->msg('e6')) if ($self->priv < 5); 
17         my @calls = DXUser::get_all_calls();
18         foreach $call (@calls) {
19                 my $ref = DXUser->get_current($call);
20                 next if !$ref;
21                 my $lat = $ref->lat;
22                 my $long = $ref->long;
23                 my $sort = $ref->sort || "";
24                 my $name = $ref->name || "";
25                 my $qth = $ref->qth || "";
26                 my $homenode = $ref->homenode || "";
27                 my $qra = $ref->qra || "";
28                 my $latlong = DXBearing::lltos($lat, $long) if $lat && $long;
29                 $latlong = "" unless $latlong;
30                 
31                 push @out, sprintf "%-9s %s %-12.12s %-27.27s %-9s %s %s", $call, $sort, $name, $qth, $homenode, $latlong, $qra;
32         }
33 } else {
34         foreach $call (@f) {
35                 my $ref = DXUser->get_current($call);
36                 if ($ref) {
37                         my $name = $ref->name;  
38                         my $qth = $ref->qth;
39                         my $lat = $ref->lat;
40                         my $long = $ref->long;
41                         my $node = $ref->node;
42                         my $homenode = $ref->homenode;
43                         my $lastin = $ref->lastin;
44                         my $latlong = DXBearing::lltos($lat, $long) if $lat || $long;
45                         my $last = DXUtil::cldatetime($lastin) if $ref->lastin;
46                         my $qra = $ref->qra;
47                         $qra = DXBearing::lltoqra($lat, $long) if !$qra && ($lat || $long);
48                         my $from;
49                         my ($dx, $bearing, $miles);
50                         if ($latlong) {
51                                 my ($hlat, $hlong) = ($self->user->lat, $self->user->long);
52                                 ($hlat, $hlong) = DXBearing::qratoll($self->user->qra) if $self->user->qra && !$hlat && !$hlong;
53                                 if (!$hlat && !$hlong) {
54                                         $from = "From $main::mycall";
55                                         $hlat = $main::mylatitude;
56                                         $hlong = $main::mylongitude;
57                                 }
58                                 ($bearing, $dx) = DXBearing::bdist($hlat, $hlong, $lat, $long);
59                                 $miles = $dx * 0.62133785;
60                         }
61                         
62                         my $cref = DXCluster->get_exact($call);
63                         $cref = DXCluster->get($call) unless $cref;
64                         my $seek = $cref->mynode->call if $cref;
65
66                         if ($seek) {
67                                 push @out, "User         : $call (at $seek)";
68                         } else {
69                                 push @out, "User         : $call";
70                         }
71                         push @out, "Name         : $name" if $name;
72                         push @out, "Last Connect : $last" if $last;
73                         push @out, "QTH          : $qth" if $qth;
74                         push @out, "Location     : $latlong ($qra)" if $latlong || $qra ;
75                         push @out, sprintf("Heading      : %.0f Deg %.0f Mi. %.0f Km.", $bearing, $miles, $dx) if $latlong;
76                         push @out, "Home Node    : $homenode" if $homenode;
77                 } else {
78                         push @out, $self->msg('usernf', $call);
79                 }
80         }
81 }
82
83 return (1, @out);