fixed sh/filter
[spider.git] / cmd / show / filter.pl
index 3b01712a6f78598f0db482142aeb44f288eeefc7..7fd7923a5093b23f96d87f42e2c795671704de22 100644 (file)
@@ -8,24 +8,29 @@
 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 && $self->priv >= 8) {
+       if (is_callsign(uc $f[0])) {
+               $call = uc shift @f;
+    } elsif ($f[0] eq 'node_default' || $f[0] eq 'user_default') {
+               $call = shift @f;
+       }
 }
 
-$sort = $f if $f;
-$sort .= 'filter';
+my @in;
+if (@f) {
+       push @in, @f;
+} else {
+       push @in, qw(ann spots wcy wwv);
+}
 
 my $key;
-foreach $key (sort keys %$self) {
-       if ($key =~ /$sort$/) {
-               push @out, $self->{$key}->print if $self->{$key};
-       }
+foreach $key (@in) {
+       my $ref = Filter::read_in($key, $call, 1);
+       push @out, $ref->print($call, $key, "input") if $ref;
+       $ref = Filter::read_in($key, $call, 0);
+       push @out, $ref->print($call, $key, "") if $ref;
 }
-push @out, $self->msg('filter3', $dxchan->call) unless @out;
+push @out, $self->msg('filter3', $call) unless @out;
 return (1, @out);