From df49d2cf8efcb2b6becf241379700f363a7014df Mon Sep 17 00:00:00 2001 From: minima Date: Tue, 22 Jun 2004 12:33:10 +0000 Subject: [PATCH] add sh/mydx alias to allow filtered spots --- Changes | 3 +++ cmd/Aliases | 4 ++++ cmd/Commands_en.hlp | 16 ++++++++++++++++ cmd/show/dx.pl | 8 ++++++-- perl/Prefix.pm | 10 ++++++++++ perl/Spot.pm | 23 +++++++++++++++++++++-- 6 files changed, 60 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index 3ead773b..900cf7b9 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +22Jun04======================================================================= +1. Add the show/mydx command which *may* filter your spots using your +spot filter. 17Jun04======================================================================= 1. alter processing of PC17 to see if they get distributed more than now. 14Jun04======================================================================= diff --git a/cmd/Aliases b/cmd/Aliases index 2b78d5d4..53e7651e 100644 --- a/cmd/Aliases +++ b/cmd/Aliases @@ -127,6 +127,10 @@ package CmdAlias; '^sho?w?/fdx/(\d+)', 'show/dx real $1', 'show/fdx', '^sho?w?/fdx/d(\d+)', 'show/dx real from $1', 'show/fdx', '^sho?w?/fdx', 'show/dx real', 'show/fdx', + '^sho?w?/myd?x?/(\d+)-(\d+)', 'show/dx filter $1-$2', 'show/mydx', + '^sho?w?/myd?x?/(\d+)', 'show/dx filter $1', 'show/mydx', + '^sho?w?/myd?x?/d(\d+)', 'show/dx filter from $1', 'show/mydx', + '^sho?w?/myd?x?', 'show/dx filter', 'show/mydx', '^sho?w?/newc/n', 'show/newconfiguration node', 'show/newconfiguration', '^sho?w?/tnc', 'who', 'who', '^sho?w?/up', 'show/cluster', 'show/cluster', diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index c20c4279..1f49e4ee 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1914,6 +1914,9 @@ any order to the basic SHOW/DX command, they are:- logging programs that can't cope with normal sh/dx output. An alias of SHOW/FDX is available. + filter Filter the spots, before output, with the user's + spot filter. An alias of SHOW/MYDX is available. + e.g. SH/DX 9m0 @@ -2129,6 +2132,19 @@ Gives you an estimate of the long path propagation characterics. It should be noted that the figures will probably not be very useful, nor terrible accurate, but it is included for completeness. +=== 0^SHOW/MYDX^Show the DX data filtered with your spot filter. +SHOW/DX potentially shows all the spots available in the system. Using +SHOW/MYDX will, instead, filter the availble spots using any spot filter +that you have set, first. + +This command, together with ACCEPT/SPOT or REJECT/SPOT, will allow +you to customise the spots that you receive. + +So if you have said: ACC/SPOT freq on hf + +Doing a SHOW/MYDX will now only, ever, show HF spots. All the other +options on SH/DX can still be used. + === 0^SHOW/NEWCONFIGURATION []^Show all the nodes and users visible This command allows you to see all the users that can be seen and the nodes to which they are connected. diff --git a/cmd/show/dx.pl b/cmd/show/dx.pl index aac5fdaf..09617113 100644 --- a/cmd/show/dx.pl +++ b/cmd/show/dx.pl @@ -22,7 +22,7 @@ my $hint; my $dxcc; my $real; my $fromdxcc; -my ($doqsl, $doiota, $doqra); +my ($doqsl, $doiota, $doqra, $dofilter); while ($f = shift @list) { # next field # print "f: $f list: ", join(',', @list), "\n"; @@ -79,6 +79,10 @@ while ($f = shift @list) { # next field } next; } + if (lc $f =~ /^filt/) { + $dofilter = 1; + next; + } if (lc $f eq 'qsl') { $doqsl = 1; next; @@ -242,7 +246,7 @@ if ($doqra) { #print "expr: $expr from: $from to: $to fromday: $fromday today: $today\n"; # now do the search -my @res = Spot::search($expr, $fromday, $today, $from, $to, $hint); +my @res = Spot::search($expr, $fromday, $today, $from, $to, $hint, $dofilter); my $ref; my @dx; foreach $ref (@res) { diff --git a/perl/Prefix.pm b/perl/Prefix.pm index 91f7c5ce..65074b83 100644 --- a/perl/Prefix.pm +++ b/perl/Prefix.pm @@ -473,6 +473,16 @@ sub to_ciz return @out; } +# get the full country data (dxcc, itu, cq, state) as a list +# from a callsign. +sub cty_data +{ + my $call = shift; + + my @dxcc = extract($call); + return @dxcc ? ($dxcc[1]->dxcc, $dxcc[1]->itu, $dxcc[1]->cq, $dxcc[1]->state) : (); +} + my %valid = ( lat => '0,Latitude,slat', long => '0,Longitude,slong', diff --git a/perl/Spot.pm b/perl/Spot.pm index 4b0e7c72..08190186 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -153,7 +153,7 @@ sub prepare sub add { - my $buf = join("\^", @_[0..7]); + my $buf = join("\^", @_); $fp->writeunix($_[2], $buf); $totalspots++; if ($_[0] <= 30000) { @@ -194,7 +194,7 @@ sub add sub search { - my ($expr, $dayfrom, $dayto, $from, $to, $hint) = @_; + my ($expr, $dayfrom, $dayto, $from, $to, $hint, $dofilter) = @_; my $eval; my @out; my $ref; @@ -233,6 +233,22 @@ sub search for (\$c = \$#spots; \$c >= 0; \$c--) { \$ref = \$spots[\$c]; if ($expr) { + if (\$dofilter && \$self->{inspotsfilter}) { + if (\@\$spot < 9) { + my i\@dxcc = Prefix::cty_data(\$spot->[1]); + if (\@dxcc) { + pop \@dxcc; + push \@\$spot, \@dxcc; + } + \@dxcc = Prefix::cty_data(\$spot->[4]); + if (\@dxcc) { + pop \@dxcc; + push \@\$spot, \@dxcc; + } + } + my (\$filter, \$hops) = \$self->{inspotsfilter}->it(\@\$spot); + next unless (\$filter); + } \$count++; next if \$count < \$from; # wait until from push(\@out, \$ref); @@ -240,6 +256,9 @@ sub search } } ); + + dbg("Spot eval: $eval") if isdbg('searcheval'); + $fp->close; # close any open files -- 2.43.0