add RBN filtering
[spider.git] / cmd / show / filter.pl
index 7289eed6f3b95a51cfc0bd266de18f0fd35a5636..ccfbc48583c980a12ee2999e8757775f9230ac1b 100644 (file)
@@ -3,29 +3,36 @@
 #
 # Copyright (c) 2000 Dirk Koopman G1TLH
 #
-# $Id$
+#
 #
 my ($self, $line) = @_;
 my @f = split /\s+/, $line;
 my @out;
-my $dxchan = $self;
-my $sort = '';
+my $call = $self->call;
 
-my $f = lc shift @f if @f;
-if ($self->priv >= 8) {
-       my $d = DXChannel->get(uc $f);
-       $dxchan = $d if $d;
-       $f = lc shift @f if @f;
+if (@f) {
+       if (is_callsign(uc $f[0])) {
+               return (1, $self->msg('e5')) unless $self->priv >= 1;
+               $call = uc shift @f;
+    } elsif ($f[0] eq 'node_default' || $f[0] eq 'user_default') {
+               return (1, $self->msg('e5')) unless $self->priv >= 1;
+               $call = shift @f;
+       }
 }
 
-$sort = $f if $f;
-$sort .= 'filter';
+my @in;
+if (@f) {
+       push @in, @f;
+} else {
+       push @in, qw(route ann spots wcy wwv rbn);
+}
 
-my $key;
-foreach $key (sort keys %$self) {
-       if ($key =~ /$sort$/) {
-               push @out, $self->{$key}->print if $self->{$key};
-       }
+my $sort;
+foreach $sort (@in) {
+       my $ref = Filter::read_in($sort, $call, 1);
+       push @out, $ref->print($call, $sort, "input") if $ref;
+       $ref = Filter::read_in($sort, $call, 0);
+       push @out, $ref->print($call, $sort, "") if $ref;
 }
-push @out, $self->msg('filter3', $dxchan->call) unless @out;
+push @out, $self->msg('filter3', $call) unless @out;
 return (1, @out);