add sh/mydx alias to allow filtered spots
authorminima <minima>
Tue, 22 Jun 2004 12:33:10 +0000 (12:33 +0000)
committerminima <minima>
Tue, 22 Jun 2004 12:33:10 +0000 (12:33 +0000)
Changes
cmd/Aliases
cmd/Commands_en.hlp
cmd/show/dx.pl
perl/Prefix.pm
perl/Spot.pm

diff --git a/Changes b/Changes
index 3ead773b9ec5f7e3b7652f6abd29a64ae1280b61..900cf7b97cb9fb77b2cd2cf96e5a3e0e930b3b85 100644 (file)
--- 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=======================================================================
index 2b78d5d48f4900149c0834fc1e05452aaa6d8cfb..53e7651e365bff5d64ddc86d3c3ee7900b51a3b8 100644 (file)
@@ -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',
index c20c42795c83b450b9b18d1de80f776dfd5d399a..1f49e4ee0f2cce71220df5e6b0270b2d740ee338 100644 (file)
@@ -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 [<node>]^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. 
index aac5fdaf27dde51d5f614642f274fef62d4f0e83..0961711347d7fd14f8650deeb3531a0d0c8af627 100644 (file)
@@ -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) {
index 91f7c5cee44a3753cf90256ca565f007c16d033e..65074b83d0c5f98c01f75e877dcfd6fee9032b4f 100644 (file)
@@ -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',
index 4b0e7c72929ba3822afe2bbc0c3faebc39b709ed..08190186ed34a869d16e845926621b4b79184590 100644 (file)
@@ -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