]> dxcluster.net Git - spider.git/commitdiff
updated filtering logic
authorminima <minima>
Thu, 2 Nov 2000 02:02:23 +0000 (02:02 +0000)
committerminima <minima>
Thu, 2 Nov 2000 02:02:23 +0000 (02:02 +0000)
Changes
perl/DXMsg.pm
perl/Filter.pm

diff --git a/Changes b/Changes
index a776e00dab4268e92361bc0b052101451943dc7a..84505f0c875c2723ad289464c4b5e2a886c82f06 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+02Nov00=======================================================================
+1. updated filtering logic. You will need to RECREATE your filters (clear/spot
+all, then start again) for testing.
 01Nov00=======================================================================
 1. put PC11 field 2 check back to m for pc text.
 2. improve 'simple' callsign checking
index 0bd27bbfa430d3d8f74ae472ff67fc4a16a98cea..60351bd40885e8fe1e7005ceec375342bb5a80cc 100644 (file)
@@ -144,6 +144,7 @@ sub process
                                my $ref = $busy{$_};
                                if (exists $ref->{lastt} && $main::systime >= $ref->{lastt} + $timeout) {
                                        dbg('msg', "Timeout, stopping msgno: $ref->{msgno} -> $node");
+                                       Log('msg', "Timeout, stopping msgno: $ref->{msgno} -> $node");
                                        $ref->stop_msg($node);
                                        
                                        # delay any outgoing messages that fail
index 37d9de6c2ed13551d1e7950b73e753b67a29d36a..7242c63660669ae56267343240d33a19de66417e 100644 (file)
@@ -178,19 +178,29 @@ sub it
        my $self = shift;
        
        my $hops = undef;
-       my $r = 1;
                
        my $filter;
-       foreach $filter ($self->getfilters) {
-               $r = 0;
+       my @keys = sort $self->getfilkeys;
+       my $key;
+       my $r = @keys > 0 ? 0 : 1;
+       foreach $key (@keys) {
+               $filter = $self->{$key};
                if ($filter->{reject} && exists $filter->{reject}->{code}) {
-                       next if &{$filter->{reject}->{code}}(\@_);                              
+                       if (&{$filter->{reject}->{code}}(\@_)) {
+                               $r = 0;
+                               last;
+                       } else {
+                               $r = 1;
+                       }               
                }
                if ($filter->{accept} && exists $filter->{accept}->{code}) {
-                       next unless &{$filter->{accept}->{code}}(\@_);                          
+                       if (&{$filter->{accept}->{code}}(\@_)) {
+                               $r = 1;
+                               last;
+                       } else {
+                               $r = 0;
+                       }                       
                } 
-               $r = 1;
-               last;
        }
 
        # hops are done differently 
@@ -379,6 +389,10 @@ sub parse
                                $s .= $tok;
                                $user .= $tok;
                                next;
+                       } elsif ($tok eq 'all') {
+                               $s .= '1';
+                               $user .= $tok;
+                               last;
                        } elsif ($tok eq 'or') {
                                $conj = ' || ' if $conj ne ' || ';
                                next;
@@ -464,7 +478,7 @@ sub parse
        $user =~ s/\!/ not /g;
        $user =~ s/\s+/ /g;
        
-       return (0, $filter, $fno, $user, "sub { my \$r = shift; return $s }");
+       return (0, $filter, $fno, $user, "sub { my \$r = shift; return ($s) ? 1 : 0 }");
 }
 
 package Filter::Old;