]> www.dxcluster.org Git - spider.git/blob - cmd/set/sys_location.pl
remove $Id$ strings from everywhere that I can find
[spider.git] / cmd / set / sys_location.pl
1 #
2 # set the system latitude and longtitude field
3 #
4 # Copyright (c) 1998 - Dirk Koopman
5 #
6 #
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('loce1')) if !$line;
20 return (1, $self->msg('loce3', uc $line)) if is_qra($line);
21 return (1, $self->msg('loce2', $line)) unless is_latlong($line);
22
23 $user = DXUser->get_current($call);
24 if ($user) {
25         $line = uc $line;
26         my ($lat, $long) = DXBearing::stoll($line);
27         $user->lat($lat);
28         $user->long($long);
29         DXChannel::broadcast_all_nodes(DXProt::pc41($call, 3, $line), $main::me);
30         if (!$user->qra) {
31                 my $qra = DXBearing::lltos($lat, $long);
32                 $user->qra($qra);
33         }
34         
35         $user->put();
36         return (1, $self->msg('sloc', $lat, $long));
37 } else {
38         return (1, $self->msg('namee2', $call));
39 }