fixed sh/filter
authorminima <minima>
Sat, 4 Nov 2000 00:08:08 +0000 (00:08 +0000)
committerminima <minima>
Sat, 4 Nov 2000 00:08:08 +0000 (00:08 +0000)
Changes
cmd/show/filter.pl
perl/DXUtil.pm
perl/Filter.pm

diff --git a/Changes b/Changes
index 12b4ea09988edf6b555c2e34766a62be0ce0dceb..3de9f88122c3fc27c91501832e31e70f8cda006f 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+04Nov00=======================================================================
+1. fix sh/filter so ity now works for any callsign (and not just connected
+ones).
 03Nov00=======================================================================
 1. allow - in filter strings
 2. store only the filter expression NOTE BENE: you will need to clear all 
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);
index db1c4c7da9c952c2a8b6482dfc0c1a41669b8ea5..b1d2b6292bef8873596676a14b58402570759836 100644 (file)
@@ -210,15 +210,6 @@ sub shellregex
        return '^' . $in . "\$";
 }
 
-# start an attempt at determining whether this string might be a callsign
-sub iscallsign
-{
-       my $call = uc shift;
-       return 1 if $call =~ /^[A-Z]+\d+[A-Z]+/;
-       return 1 if $call =~ /^\d+[A-Z]\d+[A-Z]+/;
-       return undef;
-}
-
 # read in a file into a string and return it. 
 # the filename can be split into a dir and file and the 
 # file can be in upper or lower case.
index 6359b319dfd14c2d839dbd334e812a4e7e7afd45..8acce7f383bdca5b235433509f94e1e4e98fcc7f 100644 (file)
@@ -254,19 +254,21 @@ sub write
 sub print
 {
        my $self = shift;
+       my $name = shift || $self->{name};
+       my $sort = shift || $self->{sort};
+       my $flag = shift || "";
        my @out;
-       my $name = $self->{name};
        $name =~ s/.pl$//;
        
-       push @out, join(' ',  $name , ':', $self->{sort});
+       push @out, join(' ',  $name , ':', $sort, $flag);
        my $filter;
        my $key;
        foreach $key (sort $self->getfilkeys) {
                my $filter = $self->{$key};
-               if ($filter->{reject} && exists $filter->{reject}->{user}) {
+               if (exists $filter->{reject} && exists $filter->{reject}->{user}) {
                        push @out, ' ' . join(' ', $key, 'reject', $filter->{reject}->{user});
                }
-               if ($filter->{accept} && exists $filter->{accept}->{user}) {
+               if (exists $filter->{accept} && exists $filter->{accept}->{user}) {
                        push @out, ' ' . join(' ', $key, 'accept', $filter->{accept}->{user});
                } 
        }
@@ -588,6 +590,14 @@ sub it
        }
 }
 
+sub print
+{
+       my $self = shift;
+       my $call = shift;
+       my $sort = shift;
+       my $flag = shift || "";
+       return "$call: Old Style Filter $flag $sort";
+}
 
 1;
 __END__