X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fset%2Flocation.pl;h=f4ee0358a496c0654937cc67d5482fb56b841db3;hb=47597a3f8635c4d4de89419c0c808ddcda59b9d5;hp=a9be3e006d8bccef5b7d881ed59457096219ba19;hpb=64b4171276c84a8df58776608dd9f568adef27b2;p=spider.git diff --git a/cmd/set/location.pl b/cmd/set/location.pl index a9be3e00..f4ee0358 100644 --- a/cmd/set/location.pl +++ b/cmd/set/location.pl @@ -15,18 +15,30 @@ $line =~ s/^\s+//; $line =~ s/\s+$//; return (1, $self->msg('loce1')) if !$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); 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); - if (!$user->qra) { - my $qra = DXBearing::lltos($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); + DXProt::broadcast_all_ak1a($s, $DXProt::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); + DXProt::broadcast_all_ak1a($s, $DXProt::me); } $user->put();