]> dxcluster.net Git - spider.git/blob - cmd/set/qra.pl
allow pings if connected, but with no protocol visible yet
[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                 DXProt::broadcast_all_ak1a(DXProt::pc41($call, 3, $s), $DXProt::me);
30         }
31         
32         $user->put();
33         return (1, $self->msg('qra', $line));
34 } else {
35         return (1, $self->msg('namee2', $call));
36 }
37