use vars qw($VERSION $BRANCH);
$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
-$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0;
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
$main::build += $VERSION;
$main::branch += $BRANCH;
my $hops = $self->{hops} if exists $self->{hops};
if (isdbg('filter')) {
- my $args = join '\',\'', @_;
+ my $args = join '\',\'', map {defined $_ ? $_ : 'undef'} @_;
my $true = $r ? "OK " : "REJ";
my $sort = $self->{sort};
my $dir = $self->{name} =~ /^in_/i ? "IN " : "OUT";
}
foreach $dxchan (@dxchan) {
my $n = "$in$sort" . "filter";
+ my $i = $in ? 'IN_' : '';
my $ref = $dxchan->$n();
- if (!$ref || ($ref && uc $ref->{name} eq "$name.PL")) {
+ if (!$ref || ($ref && uc $ref->{name} eq "$i$name.PL")) {
$dxchan->$n($remove ? undef : $self);
}
}
my $user;
# check the line for non legal characters
- return ('ill', $dxchan->msg('e19')) if $line =~ /[^\s\w,_\-\*\/\(\)]/;
+ return ('ill', $dxchan->msg('e19')) if $line =~ /[^\s\w,_\-\*\/\(\)!]/;
# add some spaces for ease of parsing
$line =~ s/([\(\)])/ $1 /g;
if ($s) {
$s .= $conj ;
- $s .= $not;
$user .= $conj;
- $user .= $not;
$conj = ' && ';
- $not = "";
}
+
+ if ($not) {
+ $s .= $not;
+ $user .= $not;
+ $not = '';
+ }
+
$user .= "$tok $val";
my $fref;
}
$s .= "(" . join(' || ', @t) . ")";
} elsif ($fref->[1] =~ /^n[ciz]$/ ) { # for DXCC, ITU, CQ Zone
- my @n;
my $cmd = $fref->[1];
- foreach my $v (@val) {
- if ($v =~ /^\d+$/) {
- push @n, $v unless grep $_ eq $v, @n;
- } else {
- my @pre = Prefix::extract($v);
- return ('numpre', $dxchan->msg('e27', $_)) unless @pre;
- shift @pre;
- foreach my $p (@pre) {
- my $n = $p->dxcc if $cmd eq 'nc' ;
- $n = $p->itu if $cmd eq 'ni' ;
- $n = $p->cq if $cmd eq 'nz' ;
- push @n, $n unless grep $_ eq $n, @n;
- }
- }
- }
- $s .= "(" . join(' || ', map {"\$r->[$fref->[2]]==$_"} @n) . ")";
+ my @pre = Prefix::to_ciz($cmd, @val);
+ return ('numpre', $dxchan->msg('e27', $_)) unless @pre;
+ $s .= "(" . join(' || ', map {"\$r->[$fref->[2]]==$_"} @pre) . ")";
+ } elsif ($fref->[1] =~ /^ns$/ ) { # for DXCC, ITU, CQ Zone
+ my $cmd = $fref->[1];
+ my @pre = Prefix::to_ciz($cmd, @val);
+ return ('numpre', $dxchan->msg('e27', $_)) unless @pre;
+ $s .= "(" . "!\$USDB::present || grep \$r->[$fref->[2]] eq \$_, qw(" . join(' ' ,map {uc} @pre) . "))";
} elsif ($fref->[1] eq 'r') {
my @t;
for (@val) {