From: Dirk Koopman Date: Tue, 4 Jan 2022 19:47:05 +0000 (+0000) Subject: fix RBN (and other) basecall issues X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=47fcf88853f83b34078198fdeb063791a6a7f0f2;p=spider.git fix RBN (and other) basecall issues This fix allows the code to remove ssids from calls that may be formatted like 2E1/G1TST/7-6-#. Basecall() will return the callsign without the -6-#. It will also correctly deal with OH1H/7-2 et al. returning OH1H/7 --- diff --git a/Changes b/Changes index e85130a5..091ca43a 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +04Jan22======================================================================= +1. Fix issue in the RBN (and probably other places) with callsigns that + contain trailing / in callsigns like: OH0K/6, K2PO/7 etc. 03Jan22======================================================================= 1. Allow overrides (on modern versions of perl) with things in DXVars.pm, such $clusterport. This is really only of use for people trying to run more than diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index 96f0cb83..7067c359 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -599,16 +599,15 @@ sub parraydifft sub basecall { - my ($r) = $_[0] =~ m|^(?:[\w\d]+/)?([\w\d]+).*$|; + my ($r) = $_[0] =~ m{^((?:[\w\d]+/)?[\w\d]+(?:/[\w\d]+)?)(?:-\d+)?(?:-\#)?$}; return $r; } sub normalise_call { - my ($c, $ssid) = $_[0] =~ m|^((?:[\w\d]+/)?[\d\w]+(?:/[\w\d]+)?)-?(\d+)?$|; + my ($c, $ssid) = $_[0] =~ m|^((?:[\w\d]+/)?[\d\w]+(?:/[\w\d]+)?)(?:-(\d+))?(?:-\#)?$|; my $ncall = $c; $ssid += 0; $ncall .= "-$ssid" if $ssid; return $ncall; - } diff --git a/perl/RBN.pm b/perl/RBN.pm index 0b3dfe5a..8e981fc2 100644 --- a/perl/RBN.pm +++ b/perl/RBN.pm @@ -253,6 +253,10 @@ sub normal # remove all extraneous crap from the origin - just leave the base callsign $origin = basecall($origin); + unless ($origin) { + dbg("RBN: ERROR '$origin' is an invalid callsign, dumped"); + return; + } # is this callsign in badspotter list? if ($DXProt::badspotter->in($origin) || $DXProt::badnode->in($origin)) { @@ -261,7 +265,7 @@ sub normal } # is the qrg valid - unless ($qrg =~ /^\d+\.\d{1,2}$/) { + unless ($qrg =~ /^\d+\.\d{1,3}$/) { dbg("RBN: ERROR qrg $qrg from $origin invalid, dumped"); return; }