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