1. fix sh/filter so ity now works for any callsign (and not just connected
ones).
2. Have only one is_callsign and not an iscallsign as well.
+3. Add set/hops and show/hops commands.
03Nov00=======================================================================
1. allow - in filter strings
2. store only the filter expression NOTE BENE: you will need to clear all
eg:-
SET/HOMENODE gb7djk
+=== 8^SET/HOPS <call> ann|spots|wwv|wcy <n>^Set hop count
+Set the hop count for a particular type of broadcast for a node.
+
+This command allows you to set up special hop counts for a node
+for currently: announce, spots, wwv and wcy broadcasts.
+
+eg:
+ set/hops gb7djk ann 10
+ set/hops gb7mbc spots 20
+
+Set SHOW/HOPS for information on what is already set. This command
+creates a filter and works in conjunction with the filter system.
+
=== 9^SET/ISOLATE^Isolate a node from the rest of the network
Connect a node to your system in such a way that you are a full protocol
member of its network and can see all spots on it, but nothing either leaks
Show the contents of all the filters that are set. This command displays
all the filters set - for all the various categories.
+=== 8^SHOW/HOPS <call> [ann|spots|wcy|wwv]^Show the hop counts for a node
+This command shows the hop counts set up for a node. You can specify
+which category you want to see. If you leave the category out then
+all the categories will be listed.
+
=== 1^SHOW/ISOLATE^Show list of ISOLATED nodes
=== 9^SHOW/LOCKOUT^Show the list of locked out or excluded callsigns
--- /dev/null
+#
+# set/hops commands
+#
+# Copyright (c) 2000 Dirk Koopman G1TLH
+#
+# $Id$
+#
+my ($self, $line) = @_;
+return (0, $self->msg('e5')) if $self->priv < 8;
+
+my @f = split /\s+/, $line;
+my @out;
+my $call;
+
+if (is_callsign(uc $f[0])) {
+ $call = uc shift @f;
+} elsif ($f[0] eq 'node_default' || $f[0] eq 'user_default') {
+ $call = shift @f;
+}
+
+my $sort = lc shift @f if $f[0] =~ /^ann|spots|wwv|wcy$/i;
+my $hops = shift @f if $f[0] =~ /^\d+$/;
+
+return (0, $self->msg('sethop1')) unless $call && $sort && $hops;
+
+my $ref = Filter::read_in($sort, $call, 0);
+$ref = Filter->new($sort, $call, 0) if !$ref || $ref->isa('Filter::Old');
+return (0, $self->msg('filter5', '', $sort, $call)) unless $ref;
+
+delete $ref->{hops};
+$ref->{hops} = $hops if $hops;
+$ref->write;
+$ref->install;
+
+return (0, $self->msg('sethop2', $hops, '', $sort, $call));
push @in, qw(ann spots wcy wwv);
}
-my $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;
+my $sort;
+foreach $sort (@in) {
+ my $ref = Filter::read_in($sort, $call, 1);
+ push @out, $ref->print($call, $sort, "input") if $ref;
+ $ref = Filter::read_in($sort, $call, 0);
+ push @out, $ref->print($call, $sort, "") if $ref;
}
push @out, $self->msg('filter3', $call) unless @out;
return (1, @out);
--- /dev/null
+#
+# show hops commands
+#
+# Copyright (c) 2000 Dirk Koopman G1TLH
+#
+# $Id$
+#
+my ($self, $line) = @_;
+my @f = split /\s+/, $line;
+my @out;
+my $call = $self->call;
+
+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;
+ }
+}
+
+my @in;
+if (@f) {
+ push @in, @f;
+} else {
+ push @in, qw(ann spots wcy wwv);
+}
+
+my $sort;
+foreach $sort (@in) {
+ my $ref = Filter::read_in($sort, $call, 0);
+ my $hops = $ref ? $ref->{hops} : undef;
+ push @out, $self->msg('sethop2', $hops, '', $sort, $call) if $hops;
+}
+push @out, $self->msg('sethop3', $call) unless @out;
+return (1, @out);
{
my $self = shift;
- my $hops = undef;
-
my $filter;
my @keys = sort $self->getfilkeys;
my $key;
}
}
- # hops are done differently
- if ($self->{hops}) {
- my ($comp, $ref);
- while (($comp, $ref) = each %{$self->{hops}}) {
- my ($field, $h) = @$ref;
- if ($_[$field] =~ m{$comp}) {
- $hops = $h;
- last;
- }
- }
- }
+ # hops are done differently (simply)
+ my $hops = $self->{hops} if exists $self->{hops};
+
return ($r, $hops);
}
}
$filter = Filter::read_in($sort, $call, $flag);
- $filter = Filter->new($sort, $call, $flag) unless $filter;
+ $filter = Filter->new($sort, $call, $flag) if !$filter || $filter->isa('Filter::Old');
$ntoken++;
next;
filter3 => 'No filters defined for $_[0]',
filter4 => '$_[0]$_[1] Filter $_[2] deleted for $_[3]',
filter5 => 'need some filter commands...',
+ filter6 => '$_[0]$_[1] Filter for $[2] not found',
grids => 'DX Grid flag set on $_[0]',
gridu => 'DX Grid flag unset on $_[0]',
helpe1 => 'Help system unavailable, tell sysop',
sat4 => 'Satellites available:-',
satnf => 'Satellite $_[0] unknown',
satdisc => '-----',
+ sethop1 => 'usage: set/hops <call> ann|spots|wwv|wcy <no of hops>',
+ sethop2 => '$_[0] hops set on $_[1]$_[2] for $_[3]',
+ sethop3 => 'No hops set for $_[0]',
shutting => '$main::mycall shutting down...',
sloc => 'Cluster lat $_[0] long $_[1], DON\'T FORGET TO CHANGE YOUR DXVars.pm',
snode1 => 'Node Call Sort Version',