X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fstation.pl;h=d3a70865911d65ddfcc2b00e6cdcc77b5ade8d0b;hb=337f38bfac57a5e5df34c63094fb869b0e2f6bee;hp=0f2140337ec95939b9f64308004da491d127ec84;hpb=f91e843bd91e37a969d0be7e1168649b076e5170;p=spider.git diff --git a/cmd/show/station.pl b/cmd/show/station.pl index 0f214033..d3a70865 100644 --- a/cmd/show/station.pl +++ b/cmd/show/station.pl @@ -3,40 +3,73 @@ # # Copyright (c) 1998 - Dirk Koopman G1TLH # -# $Id$ +# Modifications by Iain Philipps G0RDI, 07-Dec-1998 # my ($self, $line) = @_; my @f = split /\s+/, uc $line; my @out; my $call; +my $seek; if (@f == 0) { - return (1, "*** no station specified ***") if ($self->priv < 5); - my @calls = DXUser::get_all_calls(); - foreach $call (@calls) { - my $ref = DXUser->get_current($call); - next if !$ref; - my $sort = $ref->sort; - my $qth = $ref->qth; - my $home = $ref->node; - push @out, "$call $sort $qth $home"; - } + return (1, $self->msg('e6')) if ($self->priv < 5); + my @calls = DXUser::get_all_calls(); + foreach $call (@calls) { + my $ref = DXUser->get_current($call); + next if !$ref; + my $lat = $ref->lat; + my $long = $ref->long; + my $latlong = DXBearing::lltos($lat, $long) if $lat && $long; + push @out, sprintf "%-9s %s %-12.12s %-27.27s %-9s %s %s", $call, $ref->sort, $ref->name, $ref->qth, $ref->homenode, $latlong, $ref->qra; + } } else { - foreach $call (@f) { - my $ref = DXUser->get_current($call); - if ($ref) { - my $name = $ref->name; - my $qth = $ref->qth; - my $lat = $ref->lat; - my $long = $ref->long; - my $node = $ref->node; -# my $homenode = $ref->homenode; - push @out, "$call $qth $lat $long $node"; - } else { - push @out, "$call not known"; + foreach $call (@f) { + my $ref = DXUser->get_current($call); + if ($ref) { + my $name = $ref->name; + my $qth = $ref->qth; + my $lat = $ref->lat; + my $long = $ref->long; + my $node = $ref->node; + my $homenode = $ref->homenode; + my $lastin = $ref->lastin; + my $latlong = DXBearing::lltos($lat, $long) if $lat || $long; + my $last = DXUtil::cldatetime($lastin) if $ref->lastin; + my $qra = $ref->qra; + $qra = DXBearing::lltoqra($lat, $long) if !$qra && ($lat || $long); + my $from; + my ($dx, $bearing, $miles); + if ($latlong) { + my ($hlat, $hlong) = ($self->user->lat, $self->user->long); + ($hlat, $hlong) = DXBearing::qratoll($self->user->qra) if $self->user->qra && !$hlat && !$hlong; + if (!$hlat && !$hlong) { + $from = "From $main::mycall"; + $hlat = $main::mylatitude; + $hlong = $main::mylongitude; + } + ($bearing, $dx) = DXBearing::bdist($hlat, $hlong, $lat, $long); + $miles = $dx * 0.62133785; + } + + my $cref = DXCluster->get($call); + my $seek = $cref->mynode->call if $cref; + + if ($seek) { + push @out, "User : $call (at $seek)"; + } else { + push @out, "User : $call"; + } + push @out, "Name : $name" if $name; + push @out, "Last Connect : $last" if $last; + push @out, "QTH : $qth" if $qth; + push @out, "Location : $latlong ($qra)" if $latlong || $qra ; + push @out, sprintf("Heading : %.0f Deg %.0f Mi. %.0f Km. $from", $bearing, $miles, $dx) if $latlong; + push @out, "Home Node : $homenode" if $homenode; + } else { + push @out, $self->msg('usernf', $call); + } } - } } return (1, @out);