]> scm.dxcluster.org Git - spider.git/blob - cmd/set/location.pl
1. Added set/name, set/qra, set/location, set/qth, set/homenode, set/bbs,
[spider.git] / cmd / set / location.pl
1 #
2 # set the latitude and longtitude 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('loce1')) if !$line;
18 return (1, $self->msg('loce2', $line)) unless $line =~ /\d+ \d+ [NnSs] \d+ \d+ [EeWw]/o;
19
20 $user = DXUser->get_current($call);
21 if ($user) {
22         $line = uc $line;
23         $user->qra($line);
24         my ($lat, $long) = DXBearing::stoll($line);
25         $user->lat($lat);
26         $user->long($long);
27         DXProt::broadcast_ak1a(DXProt::pc41($call, 3, $line), $DXProt::me);
28         if (!$user->qra) {
29                 my $qra = DXBearing::lltos($lat, $long);
30                 $user->qra($qra);
31         }
32         
33         $user->put();
34         return (1, $self->msg('loc', $line));
35 } else {
36         return (1, $self->msg('namee2', $call));
37 }