updated documentation a bit
[spider.git] / cmd / set / hops.pl
1 #
2 # set/hops commands
3 #
4 # Copyright (c) 2000 Dirk Koopman G1TLH
5 #
6 # $Id$
7 #
8 my ($self, $line) = @_;
9 return (0, $self->msg('e5')) if $self->priv < 8;
10
11 my @f = split /\s+/, $line;
12 my @out;
13 my $call;
14
15 if (is_callsign(uc $f[0])) {
16         $call = uc shift @f;
17 } elsif ($f[0] eq 'node_default' || $f[0] eq 'user_default') {
18         $call = shift @f;
19 }
20
21 my $sort = lc shift @f if $f[0] =~ /^ann|spots|wwv|wcy|route$/i;
22 my $hops = shift @f if $f[0] =~ /^\d+$/;
23
24 return (0, $self->msg('sethop1')) unless $call && $sort && $hops;
25
26 my $ref = Filter::read_in($sort, $call, 0);
27 $ref = Filter->new($sort, $call, 0) if !$ref || $ref->isa('Filter::Old');
28 return (0, $self->msg('filter5', '', $sort, $call)) unless $ref;
29
30 delete $ref->{hops};
31 $ref->{hops} = $hops if $hops;
32 $ref->write;
33 $ref->install;
34
35 return (0, $self->msg('sethop2', $hops, '', $sort, $call));