X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fset%2Fqra.pl;h=a60415c351c6b5e642b8e591dc688880e1d75407;hb=b4826d1f4125788e14fed3adbb99e66242904e74;hp=0b13524e3ac1145d03689d86ad18dcbfea606465;hpb=43ac48b5c2aecc7fe27af95d4b613b8d2dd08761;p=spider.git diff --git a/cmd/set/qra.pl b/cmd/set/qra.pl index 0b13524e..a60415c3 100644 --- a/cmd/set/qra.pl +++ b/cmd/set/qra.pl @@ -1,8 +1,37 @@ # # set the qra locator field # +# Copyright (c) 1998 - Dirk Koopman +# # $Id$ # -my ($self, $args) = @_; -my $user = $self->user; -return (1, "qra locator is now ", $user->qra($args)); + +my ($self, $line) = @_; +my $call = $self->call; +my $user; + +# remove leading and trailing spaces +$line =~ s/^\s+//; +$line =~ s/\s+$//; + +return (1, $self->msg('qrae1')) if !$line; +return (1, $self->msg('qrae2', $line)) unless DXBearing::is_qra($line); + +$user = DXUser->get_current($call); +if ($user) { + $line = uc $line; + $user->qra($line); + if (!$user->lat && !$user->long) { + my ($lat, $long) = DXBearing::qratoll($line); + $user->lat($lat); + $user->long($long); + my $s = DXBearing::lltos($lat, $long); + DXProt::broadcast_ak1a(DXProt::pc41($call, 3, $s), $DXProt::me); + } + + $user->put(); + return (1, $self->msg('qra', $line)); +} else { + return (1, $self->msg('namee2', $call)); +} +