improve DXQsl handling and fix crashes?

This commit is contained in:
Dirk Koopman 2019-09-10 17:02:53 +01:00
parent c0ed0767ac
commit 112baf5b4c
5 changed files with 25 additions and 11 deletions

View File

@ -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
View 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', "$!"));

View File

@ -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
View File

@ -0,0 +1 @@
dxqsl.pl

View File

@ -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

View File

@ -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;