From 6eacc3d2fb49a6babfd77d8a0186c30968cb86ca Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Wed, 17 Nov 2021 22:18:10 +0000 Subject: [PATCH] stop self spotting bwlow 23cms (configurable) --- Changes | 3 +++ cmd/dx.pl | 24 +++++++++++++++--------- perl/DXUtil.pm | 8 +++++++- perl/RBN.pm | 2 +- perl/Spot.pm | 4 ++-- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Changes b/Changes index ae7533ce..7772728e 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,9 @@ rather than a scary exception message about multiplication thrown by one of the libraries that I use. 4. Added CTY-3126 prefixes. +5. Silently ignore self spotting below 1240000Khz (change + $Spot::minselfspot to 0 to disable or some other freq in Khz). NOTE this + will appear as a spot to the spotter's feed, but will not be passed on. 15Jul21======================================================================= 1. Fix long standing bug in crontabs that commands with " rather than ' around strings could cause those commands not to work. diff --git a/cmd/dx.pl b/cmd/dx.pl index 3fd00e6b..0a790a93 100644 --- a/cmd/dx.pl +++ b/cmd/dx.pl @@ -16,6 +16,8 @@ my $freq; my @out; my $valid = 0; my $localonly; +my $oline = $line; + return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript; return (1, $self->msg('e28')) unless $self->registered; @@ -55,20 +57,24 @@ if (is_freq($f[1]) && $f[0] =~ m{^[\w\d]+(?:/[\w\d]+){0,2}$}) { # check some other things # remove ssid from calls -my $callnoid = $self->call; -$callnoid =~ s/-\d+$//; -my $spotternoid = $spotter; -$spotternoid =~ s/-\d+$//; +my $spotternoid = basecall($spotter); +my $callnoid = basecall($self->{call}); + +#$DB::single = 1; + if ($DXProt::baddx->in($spotted)) { $localonly++; } -if ($DXProt::badspotter->in($callnoid)) { - LogDbg('DXCommand', "$self->{call} badspotter with $callnoid ($line)"); +if ($DXProt::badspotter->in($spotternoid)) { + LogDbg('DXCommand', "badspotter $spotternoid as $spotter ($oline)"); $localonly++; } -if ($callnoid ne $spotternoid && $DXProt::badspotter->in($spotternoid)) { - LogDbg('DXCommand', "$self->{call} badspotter with $spotternoid ($line)"); - $localonly++; + +dbg "spotter $spotternoid/$callnoid\n"; + +if (($spotted =~ /$spotternoid/ || $spotted =~ /$callnoid/) && $freq < $Spot::minselfspotqrg) { + LogDbg('DXCommand', "$spotternoid/$callnoid trying to self spot below ${Spot::minselfspotqrg}KHz ($oline), not passed on to cluster"); + $localonly++; } # make line the rest of the line diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index 73cda964..182cde34 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -27,7 +27,7 @@ require Exporter; print_all_fields cltounix unpad is_callsign is_latlong is_qra is_freq is_digits is_pctext is_pcflag insertitem deleteitem is_prefix dd is_ipaddr $pi $d2r $r2d localdata localdata_mv - diffms _diffms _diffus difft parraydifft is_ztime + diffms _diffms _diffus difft parraydifft is_ztime basecall ); @@ -589,3 +589,9 @@ sub parraydifft $out =~ s/,\s*$//; return $out; } + +sub basecall +{ + $_[0] =~ m|^(?:[\w\d]+/)?([\w\d]+).*$|; + return $1; +} diff --git a/perl/RBN.pm b/perl/RBN.pm index 0cf5c414..51c299c4 100644 --- a/perl/RBN.pm +++ b/perl/RBN.pm @@ -252,7 +252,7 @@ sub normal } # remove all extraneous crap from the origin - just leave the base callsign - $origin =~ s|^(?:[\w\d]+/)?([\w\d]+).*$|$1|; + $origin =~ basecall($origin); # is this callsign in badspotter list? if ($DXProt::badspotter->in($origin) || $DXProt::badnode->in($origin)) { diff --git a/perl/Spot.pm b/perl/Spot.pm index bd5f0601..e9dd2790 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -70,8 +70,8 @@ $totalspots = $hfspots = $vhfspots = 0; $use_db_for_search = 0; our %spotcache; # the cache of data within the last $spotcachedays 0 or 2+ days -our $spotcachedays = 2; - +our $spotcachedays = 2; # default 2 days worth +our $minselfspotqrg = 1240000; # minimum freq above which self spotting is allowed our $readback = 1; -- 2.34.1