X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fset%2Flocation.pl;h=834ce613d164bdac8737e76a528d237c8d21e847;hb=ab811a0c902225075a9bd69749f65594079433a9;hp=8d1f135073264b5e44290eb7ce2e7696192a0247;hpb=56c178d0f7a93f500bea68e2e999951538986f76;p=spider.git diff --git a/cmd/set/location.pl b/cmd/set/location.pl index 8d1f1350..834ce613 100644 --- a/cmd/set/location.pl +++ b/cmd/set/location.pl @@ -3,7 +3,7 @@ # # Copyright (c) 1998 - Dirk Koopman # -# $Id$ +# # my ($self, $line) = @_; @@ -15,19 +15,30 @@ $line =~ s/^\s+//; $line =~ s/\s+$//; return (1, $self->msg('loce1')) if !$line; -return (1, $self->msg('loce3', uc $line)) if DXBearing::is_qra($line); -return (1, $self->msg('loce2', $line)) unless $line =~ /\d+ \d+ [NnSs] \d+ \d+ [EeWw]/o; +return (1, $self->msg('loce3', uc $line)) if is_qra($line); +return (1, $self->msg('loce2', $line)) unless is_latlong($line); -$user = DXUser->get_current($call); +$user = DXUser::get_current($call); if ($user) { $line = uc $line; my ($lat, $long) = DXBearing::stoll($line); - $user->lat($lat); - $user->long($long); - DXProt::broadcast_all_ak1a(DXProt::pc41($call, 3, $line), $DXProt::me); - unless ($user->qra && DXBearing::is_qra($user->qra) ) { - my $qra = DXBearing::lltoqra($lat, $long); + my $oldlat = $user->lat || 0; + my $oldlong = $user->long || 0; + if ($oldlat != $lat || $oldlong != $long) { + $user->lat($lat); + $user->long($long); + my $l = DXBearing::lltos($lat, $long); + my $s = DXProt::pc41($call, 3, $l); + DXProt::eph_dup($s); + DXChannel::broadcast_all_nodes($s, $main::me) ; + } + my $qra = DXBearing::lltoqra($lat, $long); + my $oldqra = $user->qra || ""; + if ($oldqra ne $qra) { $user->qra($qra); + my $s = DXProt::pc41($call, 5, $qra); + DXProt::eph_dup($s); + DXChannel::broadcast_all_nodes($s, $main::me); } $user->put();