From: minima Date: Thu, 2 Nov 2000 02:02:23 +0000 (+0000) Subject: updated filtering logic X-Git-Tag: R_1_45~53 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=8abbe6231dec8dc08513be0ef4d2d59ac918986f;p=spider.git updated filtering logic --- diff --git a/Changes b/Changes index a776e00d..84505f0c 100644 --- 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 diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index 0bd27bbf..60351bd4 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -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 diff --git a/perl/Filter.pm b/perl/Filter.pm index 37d9de6c..7242c636 100644 --- a/perl/Filter.pm +++ b/perl/Filter.pm @@ -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;