+20Mar24======================================================================
+1. Has it really been so long since the last update?
+2. Since forever, mainly because filtering was done very early on in
+ DXSpider's development, clearing a filter needed a disconnect/reconnect
+ cycle from the user/node to activate. Now clearing or changing a filter is
+ immediately effective in the current session.
+
+ Also things like: 'rej/spot user_default on vhf' will immediately apply
+ to all users that do not already have some other filter in place. Users
+ can override this by setting a filter.
+
+ The Filter system will now show the actual token that a faulty command
+ dislikes.
25Mar23=======================================================================
1. Changed the default of X and Y (in item 2 below) to 27 and 20 respectively.
24Mar23=======================================================================
my ($self, $line) = @_;
my @f = split /\s+/, $line;
my @out;
-my $dxchan = $self;
my $sort = 'ann';
my $flag;
my $fno = 1;
-my $call = $dxchan->call;
+my $call = $self->call;
my $f;
if ($self->priv >= 8) {
$fno = shift @f if @f && $f[0] =~ /^\d|all$/;
-my $filter = Filter::read_in($sort, $call, $flag);
-Filter::delete($sort, $call, $flag, $fno);
+my $filter = Filter::read_in($sort, $call, $flag);
+Filter::delete($sort, $call, $flag, $fno, $self);
$flag = $flag ? "input " : "";
push @out, $self->msg('filter4', $flag, $sort, $fno, $call);
return (1, @out);
my ($self, $line) = @_;
my @f = split /\s+/, $line;
my @out;
-my $dxchan = $self;
my $sort = 'rbn';
my $flag;
my $fno = 1;
-my $call = $dxchan->call;
+my $call = $self->call;
my $f;
if ($self->priv >= 8) {
$fno = shift @f if @f && $f[0] =~ /^\d|all$/;
my $filter = Filter::read_in($sort, $call, $flag);
-Filter::delete($sort, $call, $flag, $fno);
+Filter::delete($sort, $call, $flag, $fno, $self);
$flag = $flag ? "input " : "";
push @out, $self->msg('filter4', $flag, $sort, $fno, $call);
return (1, @out);
my ($self, $line) = @_;
my @f = split /\s+/, $line;
my @out;
-my $dxchan = $self;
my $sort = 'route';
my $flag;
my $fno = 1;
-my $call = $dxchan->call;
+my $call = $self->call;
my $f;
if ($self->priv >= 8) {
$fno = shift @f if @f && $f[0] =~ /^\d|all$/;
my $filter = Filter::read_in($sort, $call, $flag);
-Filter::delete($sort, $call, $flag, $fno);
+Filter::delete($sort, $call, $flag, $fno, $self);
$flag = $flag ? "input " : "";
push @out, $self->msg('filter4', $flag, $sort, $fno, $call);
return (1, @out);
my ($self, $line) = @_;
my @f = split /\s+/, $line;
my @out;
-my $dxchan = $self;
my $sort = 'spots';
my $flag;
my $fno = 1;
-my $call = $dxchan->call;
+my $call = $self->call;
my $f;
if ($self->priv >= 8) {
if (@f && is_callsign(uc $f[0])) {
$f = uc shift @f;
- my $uref = DXUser::get($f);
+ my $uref = DXUser::get_current($f);
$call = $uref->call if $uref;
} elsif (@f && lc $f[0] eq 'node_default' || lc $f[0] eq 'user_default') {
$call = lc shift @f;
$fno = shift @f if @f && $f[0] =~ /^\d|all$/;
my $filter = Filter::read_in($sort, $call, $flag);
-Filter::delete($sort, $call, $flag, $fno);
+Filter::delete($sort, $call, $flag, $fno, $self);
$flag = $flag ? "input " : "";
push @out, $self->msg('filter4', $flag, $sort, $fno, $call);
return (1, @out);
my ($self, $line) = @_;
my @f = split /\s+/, $line;
my @out;
-my $dxchan = $self;
my $sort = 'wcy';
my $flag;
my $fno = 1;
-my $call = $dxchan->call;
+my $call = $self->call;
my $f;
if ($self->priv >= 8) {
$fno = shift @f if @f && $f[0] =~ /^\d|all$/;
my $filter = Filter::read_in($sort, $call, $flag);
-Filter::delete($sort, $call, $flag, $fno);
+Filter::delete($sort, $call, $flag, $fno, $self);
$flag = $flag ? "input " : "";
push @out, $self->msg('filter4', $flag, $sort, $fno, $call);
return (1, @out);
my ($self, $line) = @_;
my @f = split /\s+/, $line;
my @out;
-my $dxchan = $self;
my $sort = 'wwv';
my $flag;
my $fno = 1;
-my $call = $dxchan->call;
+my $call = $self->call;
my $f;
if ($self->priv >= 8) {
$fno = shift @f if @f && $f[0] =~ /^\d|all$/;
my $filter = Filter::read_in($sort, $call, $flag);
-Filter::delete($sort, $call, $flag, $fno);
+Filter::delete($sort, $call, $flag, $fno, $self);
$flag = $flag ? "input " : "";
push @out, $self->msg('filter4', $flag, $sort, $fno, $call);
return (1, @out);
enhanced => '5,Enhanced Client,yesno',
errors => '9,Errors',
func => '5,Function',
- group => '0,Access Group,parray',# used to create a group of users/nodes for some purpose or other.
+ group => '0,Access Group,parray',
gtk => '5,Using GTK,yesno',
handle_xml => '9,Handles XML,yesno',
here => '0,Here?,yesno',
}
}
+# try to replace the in-core version of the dxchan with the one that has been modified with items like filters
+sub replace
+{
+ my $self = shift;
+ my $call = shift;
+ if (ref $self) {
+ $call ||= $self->{call};
+ $channels{$call} = $self;
+ }
+}
+
#no strict;
sub AUTOLOAD
{
# sort out privilege reduction
$self->{priv} = 0 unless $self->{hostname} eq '127.0.0.1' || $self->conn->peerhost eq '127.0.0.1' || $self->{hostname} eq '::1' || $self->conn->{usedpasswd};
- # get the filters
- my $nossid = $call;
- $nossid =~ s/-\d+$//;
- $self->{spotsfilter} = Filter::read_in('spots', $call, 0)
- || Filter::read_in('spots', $nossid, 0)
- || Filter::read_in('spots', 'user_default', 0);
- $self->{wwvfilter} = Filter::read_in('wwv', $call, 0)
- || Filter::read_in('wwv', $nossid, 0)
- || Filter::read_in('wwv', 'user_default', 0);
- $self->{wcyfilter} = Filter::read_in('wcy', $call, 0)
- || Filter::read_in('wcy', $nossid, 0)
- || Filter::read_in('wcy', 'user_default', 0);
- $self->{annfilter} = Filter::read_in('ann', $call, 0)
- || Filter::read_in('ann', $nossid, 0)
- || Filter::read_in('ann', 'user_default', 0) ;
- $self->{rbnfilter} = Filter::read_in('rbn', $call, 0)
- || Filter::read_in('rbn', $nossid, 0)
- || Filter::read_in('rbn', 'user_default', 0);
+ Filter::load_dxchan($self, 'spots', 0);
+ Filter::load_dxchan($self, 'wwv', 0);
+ Filter::load_dxchan($self, 'wcy', 0);
+ Filter::load_dxchan($self, 'ann', 0);
+ Filter::load_dxchan($self, 'rbn', 0);
# clean up qra locators
my $qra = $user->qra;
$self->{registered} = 1;
# get the output filters
- $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'node_default', 0);
- $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'node_default', 0);
- $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'node_default', 0);
- $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'node_default', 0) ;
- $self->{routefilter} = Filter::read_in('route', $call, 0) || Filter::read_in('route', 'node_default', 0) unless $self->{isolate};
- $self->{pc92filter} = Filter::read_in('pc92', $call, 0) || Filter::read_in('pc92', 'node_default', 0) unless $self->{isolate} ;
+# $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'node_default', 0);
+# $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'node_default', 0);
+# $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'node_default', 0);
+# $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'node_default', 0) ;
+# $self->{routefilter} = Filter::read_in('route', $call, 0) || Filter::read_in('route', 'node_default', 0) unless $self->{isolate};
+# $self->{pc92filter} = Filter::read_in('pc92', $call, 0) || Filter::read_in('pc92', 'node_default', 0) unless $self->{isolate} ;
+
+ Filter::load_dxchan($self, 'spots', 0);
+ Filter::load_dxchan($self, 'wwv', 0);
+ Filter::load_dxchan($self, 'wcy', 0);
+ Filter::load_dxchan($self, 'ann', 0);
+ Filter::load_dxchan($self, 'route', 0) unless $self->{isolate};
+ Filter::load_dxchan($self, 'pc92', 0) unless $self->{isolate};
# get the INPUT filters (these only pertain to Clusters)
- $self->{inspotsfilter} = Filter::read_in('spots', $call, 1) || Filter::read_in('spots', 'node_default', 1);
- $self->{inwwvfilter} = Filter::read_in('wwv', $call, 1) || Filter::read_in('wwv', 'node_default', 1);
- $self->{inwcyfilter} = Filter::read_in('wcy', $call, 1) || Filter::read_in('wcy', 'node_default', 1);
- $self->{inannfilter} = Filter::read_in('ann', $call, 1) || Filter::read_in('ann', 'node_default', 1);
- $self->{inroutefilter} = Filter::read_in('route', $call, 1) || Filter::read_in('route', 'node_default', 1) unless $self->{isolate};
- $self->{inpc92filter} = Filter::read_in('pc92', $call, 0) || Filter::read_in('pc92', 'node_default', 0) unless $self->{isolate} ;
+# $self->{inspotsfilter} = Filter::read_in('spots', $call, 1) || Filter::read_in('spots', 'node_default', 1);
+# $self->{inwwvfilter} = Filter::read_in('wwv', $call, 1) || Filter::read_in('wwv', 'node_default', 1);
+# $self->{inwcyfilter} = Filter::read_in('wcy', $call, 1) || Filter::read_in('wcy', 'node_default', 1);
+# $self->{inannfilter} = Filter::read_in('ann', $call, 1) || Filter::read_in('ann', 'node_default', 1);
+# $self->{inroutefilter} = Filter::read_in('route', $call, 1) || Filter::read_in('route', 'node_default', 1) unless $self->{isolate};
+# $self->{inpc92filter} = Filter::read_in('pc92', $call, 0) || Filter::read_in('pc92', 'node_default', 0) unless $self->{isolate} ;
+
+ Filter::load_dxchan($self, 'spots', 1);
+ Filter::load_dxchan($self, 'wwv', 1);
+ Filter::load_dxchan($self, 'wcy', 1);
+ Filter::load_dxchan($self, 'ann', 1);
+ Filter::load_dxchan($self, 'route', 1) unless $self->{isolate};
+ Filter::load_dxchan($self, 'pc92', 1) unless $self->{isolate};
# set unbuffered and no echo
my $in = "";
$in = "in" if $name =~ s/^IN_//;
$name =~ s/.PL$//;
-
- my $dxchan;
+ my $nossid = $name;
+ $nossid =~ s/-\d+$//;
+ my $dxchan = shift;
+
my @dxchan;
if ($name eq 'NODE_DEFAULT') {
@dxchan = DXChannel::get_all_nodes();
} elsif ($name eq 'USER_DEFAULT') {
@dxchan = DXChannel::get_all_users();
+ } elsif ($dxchan) {
+ push @dxchan, $dxchan;
} else {
$dxchan = DXChannel::get($name);
push @dxchan, $dxchan if $dxchan;
foreach $dxchan (@dxchan) {
my $n = "$in$sort" . "filter";
my $i = $in ? 'IN_' : '';
- my $ref = $dxchan->$n();
- if (!$ref || ($ref && uc $ref->{name} eq "$i$name.PL")) {
- $dxchan->$n($remove ? undef : $self);
+ if ($remove) {
+ $dxchan->{$n} = undef;
+ }
+ unless ($dxchan->{$n}) {
+ Filter::load_dxchan($dxchan, $sort, $in);
}
}
}
+# This simply fixes up an existing (or recently modified) Filter into
+# an existing dxchan
+sub load_dxchan
+{
+ my $dxchan = shift;
+ my $sort = lc shift;
+ my $in = shift ? 'in' : '';
+ my $nossid = $dxchan->call;
+ $nossid =~ s/-\d+$//;
+ my $n = "$in$sort" . "filter";
+
+ $dxchan->{$n} =
+ Filter::read_in($sort, $dxchan->call, $in) ||
+ Filter::read_in($sort, $nossid, $in) ||
+ Filter::read_in($sort, $dxchan->is_user ? 'user_default' : 'node_default', $in);
+}
+
sub delete
{
- my ($sort, $call, $flag, $fno) = @_;
+ my ($sort, $call, $flag, $fno, $dxchan) = @_;
# look for the file
my $fn = getfn($sort, $call, $flag);
foreach $key ($filter->getfilkeys) {
delete $filter->{$key};
}
+ delete $filter->{getfilkeys};
} elsif (exists $filter->{"filter$fno"}) {
delete $filter->{"filter$fno"};
}
# get rid
if ($filter->{hops} || $filter->getfilkeys) {
- $filter->install;
$filter->write;
+ Filter::load_dxchan($dxchan, $sort, $in);
} else {
- $filter->install(1);
unlink $fn;
+ $filter->install(1, $dxchan);
}
}
}
last;
}
}
- return (1, $dxchan->msg('e20', $lasttok)) unless $found;
+ return (1, $dxchan->msg('e20', $tok)) unless $found;
} else {
$s = $tok =~ /^{.*}$/ ? '{' . decode_regex($tok) . '}' : $tok;
return (1, $dxchan->msg('filter2', $s));
}
}
- # tidy up the user string (why I have to stick in an if statement when I have initialised it I have no idea! 5.28 bug?
+ # tidy up the user string (why I have to stick in an if statement when I have initialised it I have no idea! 5.28 bug)?
if ($user) {
$user =~ s/\)\s*\(/ and /g;
$user =~ s/\&\&/ and /g;
dbgtrace((ref $conn) . "::DESTROY on call $call called from ${pkg}::${fn} line $line ");
}
- my $call = $conn->{call} || 'unallocated';
my $host = $conn->{peerhost} || '';
my $port = $conn->{peerport} || '';
my $sock = $conn->{sock};
$self->{priv} = 0;
# get the filters
- my $nossid = $call;
- $nossid =~ s/-\d+$//;
+# $self->{inrbnfilter} = Filter::read_in('rbn', $call, 1)
+# || Filter::read_in('rbn', 'node_default', 1);
- $self->{inrbnfilter} = Filter::read_in('rbn', $call, 1)
- || Filter::read_in('rbn', 'node_default', 1);
+ Filter::load_dxchan($self, 'rbn', 1);
# clean up qra locators
my $qra = $user->qra;
our $background;
our $mycallcolor;
our @colors;
+our $data;
+our $local_data;
# search local then perl directories
BEGIN {
# root of directory tree for this system
$root = "/spider";
$root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
+ $local_data = "$root/local_data";
+ $data = "$root/data";
unshift @INC, "$root/perl"; # this IS the right way round!
unshift @INC, "$root/local";