X-Git-Url: http://scm.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fset%2Fsys_location.pl;fp=cmd%2Fset%2Fsys_location.pl;h=3202a52181af2637830f2c2eded8d5852d3da1d4;hb=1f9712e804601df2e26f70ef88410c94546f44af;hp=0000000000000000000000000000000000000000;hpb=324bd80ed4aef7e2636f5a03288788ce11ab2663;p=spider.git diff --git a/cmd/set/sys_location.pl b/cmd/set/sys_location.pl new file mode 100644 index 00000000..3202a521 --- /dev/null +++ b/cmd/set/sys_location.pl @@ -0,0 +1,38 @@ +# +# set the system latitude and longtitude field +# +# Copyright (c) 1998 - Dirk Koopman +# +# $Id$ +# + +my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->priv < 9; + +my $call = $main::mycall; +my $user; + +# remove leading and trailing spaces +$line =~ s/^\s+//; +$line =~ s/\s+$//; + +return (1, $self->msg('loce1')) if !$line; +return (1, $self->msg('loce2', $line)) unless $line =~ /\d+ \d+ [NnSs] \d+ \d+ [EeWw]/o; + +$user = DXUser->get_current($call); +if ($user) { + $line = uc $line; + my ($lat, $long) = DXBearing::stoll($line); + $user->lat($lat); + $user->long($long); + DXProt::broadcast_ak1a(DXProt::pc41($call, 3, $line), $DXProt::me); + if (!$user->qra) { + my $qra = DXBearing::lltos($lat, $long); + $user->qra($qra); + } + + $user->put(); + return (1, $self->msg('sloc', $lat, $long)); +} else { + return (1, $self->msg('namee2', $call)); +}