+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
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);
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.
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});
}
}
}
}
+sub print
+{
+ my $self = shift;
+ my $call = shift;
+ my $sort = shift;
+ my $flag = shift || "";
+ return "$call: Old Style Filter $flag $sort";
+}
1;
__END__