spider/cmd/set/qra.pl
minima 50f6466ca2 1. fix set/lockout so that it is possible to lock out all SSIDs except those
specifically unlocked and so that you don't need to lock the non-SSID call in
order to lock an SSID call. So set/lock g1tlh will lock out all instances of
g1tlh, g1tlh-1, g1tlh-15 etc except (for instance) unset/lock g1tlh-9.
2. show/lock allows partial callsign matching so sh/lock gb7 will only show
GB7* calls that are locked.
3. Had a grand shift around for the start of NP.
2001-09-20 14:13:11 +00:00

48 lines
1.0 KiB
Perl

#
# set the qra locator field
#
# Copyright (c) 1998 - Dirk Koopman
#
# $Id$
#
my ($self, $line) = @_;
my $call = $self->call;
my $user;
# remove leading and trailing spaces
$line =~ s/^\s+//;
$line =~ s/\s+$//;
return (1, $self->msg('qrae1')) if !$line;
return (1, $self->msg('qrae2', $line)) unless is_qra($line);
$user = DXUser->get_current($call);
if ($user) {
my $qra = uc $line;
my $oldqra = $user->qra || "";
if ($oldqra ne $qra) {
$user->qra($qra);
my $s = DXProt::pc41($call, 5, $qra);
DXProt::eph_dup($s);
DXChannel::broadcast_all_nodes($s, $main::me);
}
my ($lat, $long) = DXBearing::qratoll($qra);
my $oldlat = $user->lat || 0;
my $oldlong = $user->long || 0;
if ($oldlat != $lat || $oldlong != $long) {
$user->lat($lat);
$user->long($long);
my $l = DXBearing::lltos($lat, $long);
my $s = DXProt::pc41($call, 3, $l);
DXProt::eph_dup($s);
DXChannel::broadcast_all_nodes($s, $main::me) ;
}
$user->put();
return (1, $self->msg('qra', $line));
} else {
return (1, $self->msg('namee2', $call));
}