mirror of
git://scm.dxcluster.org/scm/spider
synced 2024-09-21 07:47:10 +00:00
improve DXQsl handling and fix crashes?
This commit is contained in:
parent
c0ed0767ac
commit
112baf5b4c
3
Changes
3
Changes
@ -1,3 +1,6 @@
|
||||
10Sep19=======================================================================
|
||||
1. Improve DXSql database filtering to exclude most via <locator> type
|
||||
reports.
|
||||
14Jul18=======================================================================
|
||||
1. Add CTY-2808 prefixes + wpxloc.raw
|
||||
23Jan18=======================================================================
|
||||
|
7
cmd/load/dxqsl.pl
Normal file
7
cmd/load/dxqsl.pl
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# load the QSL file after changing it
|
||||
#
|
||||
my $self = shift;
|
||||
return (1, $self->msg('e5')) if $self->priv < 9;
|
||||
my $r = QSL::init(1);
|
||||
return (1, $r ? $self->msg('ok') : $self->msg('e2', "$!"));
|
@ -1,7 +0,0 @@
|
||||
#
|
||||
# load the QSL file after changing it
|
||||
#
|
||||
my $self = shift;
|
||||
return (1, $self->msg('e5')) if $self->priv < 9;
|
||||
my $r = QSL::init(1);
|
||||
return (1, $r ? $self->msg('ok') : $self->msg('e2', "$!"));
|
1
cmd/load/qsl.pl
Symbolic link
1
cmd/load/qsl.pl
Symbolic link
@ -0,0 +1 @@
|
||||
dxqsl.pl
|
@ -435,7 +435,8 @@ sub is_digits
|
||||
# does it look like a qra locator?
|
||||
sub is_qra
|
||||
{
|
||||
return $_[0] =~ /^[A-Ra-r][A-Ra-r]\d\d[A-Xa-x][A-Xa-x]$/;
|
||||
return unless length $_[0] == 4 || length $_[0] == 6;
|
||||
return $_[0] =~ /^[A-Ra-r][A-Ra-r]\d\d(?:[A-Xa-x][A-Xa-x])?$/;
|
||||
}
|
||||
|
||||
# does it look like a valid lat/long
|
||||
|
15
perl/QSL.pm
15
perl/QSL.pm
@ -14,9 +14,10 @@ use DB_File;
|
||||
use DXDebug;
|
||||
use Prefix;
|
||||
|
||||
use vars qw($qslfn $dbm);
|
||||
use vars qw($qslfn $dbm $maxentries);
|
||||
$qslfn = 'qsl';
|
||||
$dbm = undef;
|
||||
$maxentries = 50;
|
||||
|
||||
sub init
|
||||
{
|
||||
@ -37,6 +38,7 @@ sub init
|
||||
}
|
||||
import Storable qw(nfreeze freeze thaw);
|
||||
my %u;
|
||||
undef $dbm;
|
||||
if ($mode) {
|
||||
$dbm = tie (%u, 'DB_File', $ufn, O_CREAT|O_RDWR, 0666, $DB_BTREE) or confess "can't open qsl file: $qslfn ($!)";
|
||||
} else {
|
||||
@ -65,19 +67,24 @@ sub update
|
||||
my $t = shift;
|
||||
my $by = shift;
|
||||
my $changed;
|
||||
|
||||
|
||||
return unless length $line && $line =~ /\b(?:QSL|VIA)\b/i;
|
||||
foreach my $man (split /\b/, uc $line) {
|
||||
my $tok;
|
||||
|
||||
if (is_callsign($man)) {
|
||||
if (is_callsign($man) && !is_qra($man)) {
|
||||
my @pre = Prefix::extract($man);
|
||||
$tok = $man if @pre && $pre[0] ne 'Q';
|
||||
} elsif ($man =~ /^BUR/) {
|
||||
$tok = 'BUREAU';
|
||||
} elsif ($man =~ /^LOTW/) {
|
||||
$tok = 'LOTW';
|
||||
} elsif ($man eq 'HC' || $man =~ /^HOM/ || $man =~ /^DIR/) {
|
||||
$tok = 'HOME CALL';
|
||||
} elsif ($man =~ /^QRZ/) {
|
||||
$tok = 'QRZ.com';
|
||||
} else {
|
||||
next;
|
||||
}
|
||||
if ($tok) {
|
||||
my ($r) = grep {$_->[0] eq $tok} @{$self->[1]};
|
||||
@ -93,6 +100,8 @@ sub update
|
||||
unshift @{$self->[1]}, $r;
|
||||
$changed++;
|
||||
}
|
||||
# prune the number of entries
|
||||
pop @{$self->[1]} while (@{$self->[1]} > $maxentries);
|
||||
}
|
||||
}
|
||||
$self->put if $changed;
|
||||
|
Loading…
Reference in New Issue
Block a user