484666ca953efa3e638fdd077417f459823676b5
[spider.git] / cmd / set / qra.pl
1 #
2 # set the qra locator field
3 #
4 # Copyright (c) 1998 - Dirk Koopman
5 #
6 # $Id$
7 #
8
9 my ($self, $line) = @_;
10 my $call = $self->call;
11 my $user;
12
13 # remove leading and trailing spaces
14 $line =~ s/^\s+//;
15 $line =~ s/\s+$//;
16
17 return (1, $self->msg('qrae1')) if !$line;
18 return (1, $self->msg('qrae2', $line)) unless DXBearing::is_qra($line);
19
20 $user = DXUser->get_current($call);
21 if ($user) {
22         $line = uc $line;
23         $user->qra($line);
24         if (!$user->lat && !$user->long) {
25                 my ($lat, $long) = DXBearing::qratoll($line);
26                 $user->lat($lat);
27                 $user->long($long);
28                 my $s = DXBearing::lltos($lat, $long);
29                 my $l = DXProt::pc41($call, 3, $s);
30                 DXProt::eph_dup($l);
31                 DXProt::broadcast_all_ak1a($l, $DXProt::me) ;
32         }
33         
34         $user->put();
35         return (1, $self->msg('qra', $line));
36 } else {
37         return (1, $self->msg('namee2', $call));
38 }
39