X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FThingy%2FRouteFilter.pm;h=79ed6f35407d947ce3ce5fd9dcac8f4d47531f18;hb=decf4e82a66a51f03216dd7531422868cd03611b;hp=ac238ffef048782b8e13d3865666b839ba96b0d6;hpb=eb2a2eb1aa8e7c743c23ec5e0dc5aa40a8708e79;p=spider.git diff --git a/perl/Thingy/RouteFilter.pm b/perl/Thingy/RouteFilter.pm index ac238ffe..79ed6f35 100644 --- a/perl/Thingy/RouteFilter.pm +++ b/perl/Thingy/RouteFilter.pm @@ -28,10 +28,13 @@ use vars qw(@ISA); sub _filter { my $dxchan = shift; - my $r = shift; + my @out; - my ($filter, $hops) = $dxchan->{inroutefilter}->it($dxchan->{call}, $dxchan->{dxcc}, $dxchan->{itu}, $dxchan->{cq}, $r->{call}, $r->{dxcc}, $r->{itu}, $r->{cq}, $dxchan->{state}, $r->{state}); - return $filter ? $r : undef; + foreach my $r (@_) { + my ($filter, $hops) = $dxchan->{routefilter}->it($dxchan->{call}, $dxchan->{dxcc}, $dxchan->{itu}, $dxchan->{cq}, $r->{call}, $r->{dxcc}, $r->{itu}, $r->{cq}, $dxchan->{state}, $r->{state}); + push @out, $r if $filter; + } + return @out; } sub gen_DXProt @@ -39,9 +42,9 @@ sub gen_DXProt my $thing = shift; my @out; push @out, DXProt::pc21(@{$thing->{fpc21n}}) if $thing->{fpc21n}; - push @out, DXProt::pc17($thing->{fpc17n}, @{$thing->{pc17u}}) if $thing->{fpc17n}; + push @out, DXProt::pc17($thing->{fpc17n}, @{$thing->{pc17u}}) if $thing->{pc17u} && $thing->{fpc17n}; push @out, DXProt::pc19(@{$thing->{fpc19n}}) if $thing->{fpc19n}; - push @out, DXProt::pc16($thing->{fpc16n}, @{$thing->{pc16u}}) if $thing->{fpc16n}; + push @out, DXProt::pc16($thing->{fpc16n}, @{$thing->{pc16u}}) if $thing->{pc16u} && $thing->{fpc16n}; return \@out; } @@ -85,10 +88,14 @@ sub out_filter delete $thing->{fpc19n}; delete $thing->{fpc21n}; - $thing->{fpc16n} = _filter($dxchan, $thing->{pc16n}) if $thing->{pc16n}; - $thing->{fpc17n} = _filter($dxchan, $thing->{pc17n}) if $thing->{pc17n}; - $thing->{fpc19n} = [_filter($dxchan, @{$thing->{pc19n}})] if $thing->{pc19n}; - $thing->{fpc21n} = [_filter($dxchan, @{$thing->{pc21n}})] if $thing->{pc21n}; + my @n16 = _filter($dxchan, $thing->{pc16n}) if $thing->{pc16u} && $thing->{pc16n}; + $thing->{fpc16n} = $n16[0] if @n16; + my @n17 = _filter($dxchan, $thing->{pc17n}) if $thing->{pc17u} && $thing->{pc17n}; + $thing->{fpc17n} = $n17[0] if @n17; + my @pc19 = _filter($dxchan, @{$thing->{pc19n}}) if $thing->{pc19n}; + $thing->{fpc19n} = \@pc19 if @pc19; + my @pc21 = _filter($dxchan, @{$thing->{pc21n}}) if $thing->{pc21n}; + $thing->{fpc21n} = \@pc21 if @pc21; } return 1;