X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fset%2Flocation.pl;h=25db6ba609259c4c3f2f803f4edfe7decd4ca4a4;hb=58234eafde7d75028574ae6aa519d2197120c558;hp=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391;hpb=6b6a8002929017b6d4217f68fa492a2d728ee1fe;p=spider.git diff --git a/cmd/set/location.pl b/cmd/set/location.pl index e69de29b..25db6ba6 100644 --- a/cmd/set/location.pl +++ b/cmd/set/location.pl @@ -0,0 +1,39 @@ +# +# set the latitude and longtitude field +# +# Copyright (c) 1998 - Dirk Koopman +# +# $Id$ +# + +my ($self, $line) = @_; +my $call = $self->call; +my $user; + +# remove leading and trailing spaces +$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; + +$user = DXUser->get_current($call); +if ($user) { + $line = uc $line; + my ($lat, $long) = DXBearing::stoll($line); + $user->lat($lat); + $user->long($long); + my $s = DXProt::pc41($call, 3, $line); + DXProt::eph_dup($s); + DXProt::broadcast_all_ak1a($s, $DXProt::me) ; + unless ($user->qra && DXBearing::is_qra($user->qra) ) { + my $qra = DXBearing::lltoqra($lat, $long); + $user->qra($qra); + } + + $user->put(); + return (1, $self->msg('loc', $line)); +} else { + return (1, $self->msg('namee2', $call)); +}