From 6ccc3a6e864a2fee18786a7070400c7c4f22cf7c Mon Sep 17 00:00:00 2001 From: minima Date: Mon, 10 Sep 2001 00:38:32 +0000 Subject: [PATCH] 1. clear/* node_default and user_default now work. 2. in acc or rej/* you can now use (comma separated) prefixes as well as lists of numbers for things like *_dxcc, *_itu and *_cq (eg: by_dxcc ve,w); just remember that countries like ve and w have lots of zones and itus! 3. Added all the clear/* commands to help and added some comments about 2. 4. All filters (including *_default ones) are now reinstalled on channels in realtime, so changing a filter does NOT require a disconnect and reconnect cycle anymore. --- Changes | 9 +++ cmd/Commands_en.hlp | 177 +++++++++++++++++++++++++++--------------- cmd/clear/announce.pl | 21 ++--- cmd/clear/route.pl | 21 ++--- cmd/clear/spots.pl | 10 ++- cmd/clear/wcy.pl | 21 ++--- cmd/clear/wwv.pl | 21 ++--- perl/AnnTalk.pm | 14 ++-- perl/Filter.pm | 38 ++++++++- perl/Geomag.pm | 14 ++-- perl/Messages | 1 + perl/Route.pm | 12 +-- perl/Spot.pm | 14 ++-- perl/WCY.pm | 14 ++-- 14 files changed, 244 insertions(+), 143 deletions(-) diff --git a/Changes b/Changes index 79858fa3..a34ac304 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,12 @@ +10Sep01======================================================================= +1. clear/* node_default and user_default now work. +2. in acc or rej/* you can now use (comma separated) prefixes as well as lists +of numbers for things like *_dxcc, *_itu and *_cq (eg: by_dxcc ve,w); just +remember that countries like ve and w have lots of zones and itus! +3. Added all the clear/* commands to help and added some comments about 2. +4. All filters (including *_default ones) are now reinstalled on channels in +realtime, so changing a filter does NOT require a disconnect and reconnect +cycle anymore. 09Sep01======================================================================= 1. Add show/dxstats command 2. Add show/hfstats command diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 3098cc29..bf86e535 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -23,12 +23,12 @@ You can use any of the following things in this line:- info eg: iota or qsl by eg: G,M,2 origin - origin_dxcc eg: 61,62 (from eg: sh/pre G) - origin_itu - origin_zone - by_dxcc - by_itu - by_zone + origin_dxcc eg: 61,62 (from eg: sh/pre G) + origin_itu or: G,GM,GW + origin_zone + by_dxcc + by_itu + by_zone channel wx 1 filter WX announces dest eg: 6MUK,WDX (distros) @@ -65,13 +65,13 @@ to understand how filters work - it will save a lot of grief later on. You can use any of the following things in this line:- call the callsign of the thingy - call_dxcc eg: 61,62 (from eg: sh/pre G) - call_itu - call_zone + call_dxcc eg: 61,62 (from eg: sh/pre G) + call_itu or: G,GM,GW + call_zone origin really the interface it came in on - origin_dxcc eg: 61,62 (from eg: sh/pre G) - origin_itu - origin_zone + origin_dxcc eg: 61,62 (from eg: sh/pre G) + origin_itu or: G,GM,GW + origin_zone some examples:- @@ -97,12 +97,12 @@ You can use any of the following things in this line:- call eg: G,PA,HB9 info eg: iota or qsl by - call_dxcc eg: 61,62 (from eg: sh/pre G) - call_itu - call_zone - by_dxcc - by_itu - by_zone + call_dxcc eg: 61,62 (from eg: sh/pre G) + call_itu or: G,GM,GW + call_zone + by_dxcc + by_itu + by_zone origin channel @@ -140,12 +140,12 @@ filter on the following fields:- by eg: G,M,2 origin - origin_dxcc eg: 61,62 (from eg: sh/pre G) - origin_itu - origin_zone - by_dxcc - by_itu - by_zone + origin_dxcc eg: 61,62 (from eg: sh/pre G) + origin_itu or: G,GM,GW + origin_zone + by_dxcc + by_itu + by_zone channel There are no examples because WCY Broadcasts only come from one place and @@ -168,12 +168,12 @@ filter on the following fields:- by eg: G,M,2 origin - origin_dxcc eg: 61,62 (from eg: sh/pre G) - origin_itu - origin_zone - by_dxcc - by_itu - by_zone + origin_dxcc eg: 61,62 (from eg: sh/pre G) + origin_itu or: G,GM,GW + origin_zone + by_dxcc + by_itu + by_zone channel for example @@ -231,7 +231,27 @@ which will arrange for them to be forward candidates again. Order is not important. -=== 0^CLEAR/SPOTS [1|all]^Clear a spot filter line +=== 0^CLEAR/ANNOUNCE [1|all]^Clear a announce filter line +This command allows you to clear (remove) a line in a annouce filter or to +remove the whole filter. + +see CLEAR/SPOTS for a more detailed explanation. + +=== 8^CLEAR/ANNOUNCE [input] [0-9|all]^Clear a announce filter line +A sysop can clear an input or normal output filter for a user or the +node_default or user_default. + +=== 0^CLEAR/ROUTE [1|all]^Clear a route filter line +This command allows you to clear (remove) a line in a route filter or to +remove the whole filter. + +see CLEAR/SPOTS for a more detailed explanation. + +=== 8^CLEAR/ROUTE [input] [0-9|all]^Clear a route filter line +A sysop can clear an input or normal output filter for a user or the +node_default or user_default. + +=== 0^CLEAR/SPOTS [0-9|all]^Clear a spot filter line This command allows you to clear (remove) a line in a spot filter or to remove the whole filter. @@ -254,14 +274,41 @@ If you do: the filter will be completely removed. +=== 8^CLEAR/SPOTS [input] [0-9|all]^Clear a spot filter line +A sysop can clear an input or normal output filter for a user or the +node_default or user_default. + +=== 0^CLEAR/WCY [1|all]^Clear a WCY filter line +This command allows you to clear (remove) a line in a WCY filter or to +remove the whole filter. + +see CLEAR/SPOTS for a more detailed explanation. + +=== 8^CLEAR/WCY [input] [0-9|all]^Clear a WCY filter line +A sysop can clear an input or normal output filter for a user or the +node_default or user_default. + +=== 0^CLEAR/WWV [1|all]^Clear a WWV filter line +This command allows you to clear (remove) a line in a WWV filter or to +remove the whole filter. + +see CLEAR/SPOTS for a more detailed explanation. + +=== 8^CLEAR/WWV [input] [0-9|all]^Clear a WWV filter line +A sysop can clear an input or normal output filter for a user or the +node_default or user_default. + === 5^CONNECT ^Start a connection to another DX Cluster Start a connection process that will culminate in a new connection to the DX cluster . This process creates a new 'client' process which will use the script in /spider/connect/ to effect the 'chat' exchange necessary to traverse the network(s) to logon to the cluster . -=== 9^DELELE/USER ...^Delete this user from the User Database +=== 9^DELETE/USER ...^Delete this user from the User Database This command will completely remove a one or more users from the database. + +There is NO SECOND CHANCE. + It goes without saying that you should use this command CAREFULLY! === 0^DBAVAIL^Show a list of all the Databases in the system @@ -559,6 +606,12 @@ To remove the filter in its entirty:- clear/spots all +There are similar CLEAR commands for the other filters:- + + clear/announce + clear/wcy + clear/wwv + ADVANCED USERS:- Once you are happy with the results you get, you may like to experiment. @@ -780,12 +833,12 @@ You can use any of the following things in this line:- info eg: iota or qsl by eg: G,M,2 origin - origin_dxcc eg: 61,62 (from eg: sh/pre G) - origin_itu - origin_zone - by_dxcc - by_itu - by_zone + origin_dxcc eg: 61,62 (from eg: sh/pre G) + origin_itu or: G,GM,GW + origin_zone + by_dxcc + by_itu + by_zone channel wx 1 filter WX announces dest eg: 6MUK,WDX (distros) @@ -822,12 +875,12 @@ You can use any of the following things in this line:- call eg: G,PA,HB9 info eg: iota or qsl by - call_dxcc eg: 61,62 (from eg: sh/pre G) - call_itu - call_zone - by_dxcc - by_itu - by_zone + call_dxcc eg: 61,62 (from eg: sh/pre G) + call_itu or: G,GM,GW + call_zone + by_dxcc + by_itu + by_zone origin channel @@ -858,13 +911,13 @@ read this to understand how filters work - it will save a lot of grief later on. You can use any of the following things in this line:- call the callsign of the thingy - call_dxcc eg: 61,62 (from eg: sh/pre G) - call_itu - call_zone + call_dxcc eg: 61,62 (from eg: sh/pre G) + call_itu or: G,GM,GW + call_zone origin really the interface it came in on - origin_dxcc eg: 61,62 (from eg: sh/pre G) - origin_itu - origin_zone + origin_dxcc eg: 61,62 (from eg: sh/pre G) + origin_itu or: G,GM,GW + origin_zone some examples:- @@ -890,12 +943,12 @@ filter on the following fields:- by eg: G,M,2 origin - origin_dxcc eg: 61,62 (from eg: sh/pre G) - origin_itu - origin_zone - by_dxcc - by_itu - by_zone + origin_dxcc eg: 61,62 (from eg: sh/pre G) + origin_itu or: G,GM,GW + origin_zone + by_dxcc + by_itu + by_zone channel There are no examples because WCY Broadcasts only come from one place and @@ -917,12 +970,12 @@ filter on the following fields:- by eg: G,M,2 origin - origin_dxcc eg: 61,62 (from eg: sh/pre G) - origin_itu - origin_zone - by_dxcc - by_itu - by_zone + origin_dxcc eg: 61,62 (from eg: sh/pre G) + origin_itu or: G,GM,GW + origin_zone + by_dxcc + by_itu + by_zone channel for example diff --git a/cmd/clear/announce.pl b/cmd/clear/announce.pl index 41b29b42..5ee0b424 100644 --- a/cmd/clear/announce.pl +++ b/cmd/clear/announce.pl @@ -13,23 +13,24 @@ my $sort = 'ann'; my $flag; my $fno = 1; my $call = $dxchan->call; +my $f; -my $f = lc shift @f if @f; if ($self->priv >= 8) { - if (is_callsign(uc $f)) { - my $uref = DXUser->get(uc $f); + if (@f && is_callsign(uc $f[0])) { + $f = uc shift @f; + my $uref = DXUser->get($f); $call = $uref->call if $uref; + } elsif (@f && lc $f[0] eq 'node_default' || lc $f[0] eq 'user_default') { + $call = lc shift @f; } - if (@f) { - $f = lc shift @f; - if ($f eq 'input') { - $flag = 'in'; - $f = shift @f if @f; - } + if (@f && $f[0] eq 'input') { + shift @f; + $flag = 'in'; } } -$fno = $f if $f; +$fno = shift @f if @f && $f[0] =~ /^\d|all$/; + my $filter = Filter::read_in($sort, $call, $flag); Filter::delete($sort, $call, $flag, $fno); $flag = $flag ? "input " : ""; diff --git a/cmd/clear/route.pl b/cmd/clear/route.pl index 9cc3705a..d5a3dfd2 100644 --- a/cmd/clear/route.pl +++ b/cmd/clear/route.pl @@ -13,23 +13,24 @@ my $sort = 'route'; my $flag; my $fno = 1; my $call = $dxchan->call; +my $f; -my $f = lc shift @f if @f; if ($self->priv >= 8) { - if (is_callsign(uc $f)) { - my $uref = DXUser->get(uc $f); + if (@f && is_callsign(uc $f[0])) { + $f = uc shift @f; + my $uref = DXUser->get($f); $call = $uref->call if $uref; + } elsif (@f && lc $f[0] eq 'node_default' || lc $f[0] eq 'user_default') { + $call = lc shift @f; } - if (@f) { - $f = lc shift @f; - if ($f eq 'input') { - $flag = 'in'; - $f = shift @f if @f; - } + if (@f && $f[0] eq 'input') { + shift @f; + $flag = 'in'; } } -$fno = $f if $f; +$fno = shift @f if @f && $f[0] =~ /^\d|all$/; + my $filter = Filter::read_in($sort, $call, $flag); Filter::delete($sort, $call, $flag, $fno); $flag = $flag ? "input " : ""; diff --git a/cmd/clear/spots.pl b/cmd/clear/spots.pl index d2a59bc0..e2c8a761 100644 --- a/cmd/clear/spots.pl +++ b/cmd/clear/spots.pl @@ -6,7 +6,7 @@ # $Id$ # my ($self, $line) = @_; -my @f = split(/\s+/, $line); +my @f = split /\s+/, $line; my @out; my $dxchan = $self; my $sort = 'spots'; @@ -16,18 +16,20 @@ my $call = $dxchan->call; my $f; if ($self->priv >= 8) { - if (is_callsign(uc $f[0])) { + if (@f && is_callsign(uc $f[0])) { $f = uc shift @f; my $uref = DXUser->get($f); $call = $uref->call if $uref; + } elsif (@f && lc $f[0] eq 'node_default' || lc $f[0] eq 'user_default') { + $call = lc shift @f; } - if ($f[0] eq 'input') { + if (@f && $f[0] eq 'input') { shift @f; $flag = 'in'; } } -$fno = shift @f if @f && $f[0] =~ /^\d$/; +$fno = shift @f if @f && $f[0] =~ /^\d|all$/; my $filter = Filter::read_in($sort, $call, $flag); Filter::delete($sort, $call, $flag, $fno); diff --git a/cmd/clear/wcy.pl b/cmd/clear/wcy.pl index dfcc8da4..cb0dd076 100644 --- a/cmd/clear/wcy.pl +++ b/cmd/clear/wcy.pl @@ -13,23 +13,24 @@ my $sort = 'wcy'; my $flag; my $fno = 1; my $call = $dxchan->call; +my $f; -my $f = lc shift @f if @f; if ($self->priv >= 8) { - if (is_callsign(uc $f)) { - my $uref = DXUser->get(uc $f); + if (@f && is_callsign(uc $f[0])) { + $f = uc shift @f; + my $uref = DXUser->get($f); $call = $uref->call if $uref; + } elsif (@f && lc $f[0] eq 'node_default' || lc $f[0] eq 'user_default') { + $call = lc shift @f; } - if (@f) { - $f = lc shift @f; - if ($f eq 'input') { - $flag = 'in'; - $f = shift @f if @f; - } + if (@f && $f[0] eq 'input') { + shift @f; + $flag = 'in'; } } -$fno = $f if $f; +$fno = shift @f if @f && $f[0] =~ /^\d|all$/; + my $filter = Filter::read_in($sort, $call, $flag); Filter::delete($sort, $call, $flag, $fno); $flag = $flag ? "input " : ""; diff --git a/cmd/clear/wwv.pl b/cmd/clear/wwv.pl index 01f1390f..870710ce 100644 --- a/cmd/clear/wwv.pl +++ b/cmd/clear/wwv.pl @@ -13,23 +13,24 @@ my $sort = 'wwv'; my $flag; my $fno = 1; my $call = $dxchan->call; +my $f; -my $f = lc shift @f if @f; if ($self->priv >= 8) { - if (is_callsign(uc $f)) { - my $uref = DXUser->get(uc $f); + if (@f && is_callsign(uc $f[0])) { + $f = uc shift @f; + my $uref = DXUser->get($f); $call = $uref->call if $uref; + } elsif (@f && lc $f[0] eq 'node_default' || lc $f[0] eq 'user_default') { + $call = lc shift @f; } - if (@f) { - $f = lc shift @f; - if ($f eq 'input') { - $flag = 'in'; - $f = shift @f if @f; - } + if (@f && $f[0] eq 'input') { + shift @f; + $flag = 'in'; } } -$fno = $f if $f; +$fno = shift @f if @f && $f[0] =~ /^\d|all$/; + my $filter = Filter::read_in($sort, $call, $flag); Filter::delete($sort, $call, $flag, $fno); $flag = $flag ? "input " : ""; diff --git a/perl/AnnTalk.pm b/perl/AnnTalk.pm index 982e9c49..b48dc7e0 100644 --- a/perl/AnnTalk.pm +++ b/perl/AnnTalk.pm @@ -27,13 +27,13 @@ $filterdef = bless ([ ['group', 't', 3], ['origin', 'c', 4], ['wx', 't', 5], - ['channel', 'n', 6], - ['by_dxcc', 'n', 7], - ['by_itu', 'n', 8], - ['by_zone', 'n', 9], - ['origin_dxcc', 'n', 10], - ['origin_itu', 'n', 11], - ['origin_itu', 'n', 12], + ['channel', 'c', 6], + ['by_dxcc', 'nc', 7], + ['by_itu', 'ni', 8], + ['by_zone', 'nz', 9], + ['origin_dxcc', 'nc', 10], + ['origin_itu', 'ni', 11], + ['origin_zone', 'nz', 12], ], 'Filter::Cmd'); use vars qw($VERSION $BRANCH); diff --git a/perl/Filter.pm b/perl/Filter.pm index abdcaba7..b027041c 100644 --- a/perl/Filter.pm +++ b/perl/Filter.pm @@ -30,6 +30,7 @@ use DXVars; use DXUtil; use DXDebug; use Data::Dumper; +use Prefix; use strict; @@ -297,10 +298,22 @@ sub install $in = "in" if $name =~ s/^IN_//; $name =~ s/.PL$//; - my $dxchan = DXChannel->get($name); - if ($dxchan) { + my $dxchan; + my @dxchan; + if ($name eq 'NODE_DEFAULT') { + @dxchan = DXChannel::get_all_nodes(); + } elsif ($name eq 'USER_DEFAULT') { + @dxchan = DXChannel::get_all_users(); + } else { + $dxchan = DXChannel->get($name); + push @dxchan, $dxchan if $dxchan; + } + foreach $dxchan (@dxchan) { my $n = "$in$sort" . "filter"; - $dxchan->$n($remove ? undef : $self); + my $ref = $dxchan->$n; + if (!$ref || ($ref && uc $ref->{name} eq "$name.PL")) { + $dxchan->$n($remove ? undef : $self); + } } } @@ -471,6 +484,25 @@ sub parse push @t, "\$r->[$fref->[2]]==$_"; } $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) . ")"; } elsif ($fref->[1] eq 'r') { my @t; for (@val) { diff --git a/perl/Geomag.pm b/perl/Geomag.pm index dc003638..8f17eaf3 100644 --- a/perl/Geomag.pm +++ b/perl/Geomag.pm @@ -51,13 +51,13 @@ $filterdef = bless ([ # tag, sort, field, priv, special parser ['by', 'c', 7], ['origin', 'c', 8], - ['channel', 'n', 9], - ['by_dxcc', 'n', 10], - ['by_itu', 'n', 11], - ['by_zone', 'n', 12], - ['origin_dxcc', 'c', 13], - ['origin_itu', 'c', 14], - ['origin_itu', 'c', 15], + ['channel', 'c', 9], + ['by_dxcc', 'nc', 10], + ['by_itu', 'ni', 11], + ['by_zone', 'nz', 12], + ['origin_dxcc', 'nc', 13], + ['origin_itu', 'ni', 14], + ['origin_zone', 'nz', 15], ], 'Filter::Cmd'); sub init diff --git a/perl/Messages b/perl/Messages index c6c5d8a6..69db5386 100644 --- a/perl/Messages +++ b/perl/Messages @@ -77,6 +77,7 @@ package DXM; e24 => 'Sorry, Internet access is not enabled', e25 => 'Sorry the value must be between $_[0] and $_[1]', e26 => 'Too many concurrent errors, you are being disconnected', + e27 => '$_[0] not a numeric or a callsign prefix', echoon => 'Echoing enabled', echooff => 'Echoing disabled', diff --git a/perl/Route.pm b/perl/Route.pm index ee84c150..a1b9f004 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -40,13 +40,13 @@ use vars qw(%list %valid $filterdef); $filterdef = bless ([ # tag, sort, field, priv, special parser ['channel', 'c', 0], - ['channel_dxcc', 'n', 1], - ['channel_itu', 'n', 2], - ['channel_zone', 'n', 3], + ['channel_dxcc', 'nc', 1], + ['channel_itu', 'ni', 2], + ['channel_zone', 'nz', 3], ['call', 'c', 4], - ['call_dxcc', 'n', 5], - ['call_itu', 'n', 6], - ['call_zone', 'n', 7], + ['call_dxcc', 'nc', 5], + ['call_itu', 'ni', 6], + ['call_zone', 'nz', 7], ], 'Filter::Cmd'); diff --git a/perl/Spot.pm b/perl/Spot.pm index be8be669..06bf8655 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -43,14 +43,14 @@ $filterdef = bless ([ ['call', 'c', 1], ['info', 't', 3], ['by', 'c', 4], - ['call_dxcc', 'n', 5], - ['by_dxcc', 'n', 6], + ['call_dxcc', 'nc', 5], + ['by_dxcc', 'nc', 6], ['origin', 'c', 7, 9], - ['call_itu', 'n', 8], - ['call_zone', 'n', 9], - ['by_itu', 'n', 10], - ['by_zone', 'n', 11], - ['channel', 'n', 12, 9], + ['call_itu', 'ni', 8], + ['call_zone', 'nz', 9], + ['by_itu', 'ni', 10], + ['by_zone', 'nz', 11], + ['channel', 'c', 12], ], 'Filter::Cmd'); diff --git a/perl/WCY.pm b/perl/WCY.pm index bccf815b..85f2b817 100644 --- a/perl/WCY.pm +++ b/perl/WCY.pm @@ -52,13 +52,13 @@ $filterdef = bless ([ # tag, sort, field, priv, special parser ['by', 'c', 11], ['origin', 'c', 12], - ['channel', 'n', 13], - ['by_dxcc', 'n', 14], - ['by_itu', 'n', 15], - ['by_zone', 'n', 16], - ['origin_dxcc', 'c', 17], - ['origin_itu', 'c', 18], - ['origin_itu', 'c', 19], + ['channel', 'c', 13], + ['by_dxcc', 'nc', 14], + ['by_itu', 'ni', 15], + ['by_zone', 'nz', 16], + ['origin_dxcc', 'nc', 17], + ['origin_itu', 'ni', 18], + ['origin_zone', 'nz', 19], ], 'Filter::Cmd'); -- 2.43.0