X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fconfiguration.pl;h=7c3281eadb8f193818ec555ee678d580ff69c163;hb=655500414f1c3c7dbf9aecbc33c648705ef0cbde;hp=6f2e1e935a8014f06c5373138675fc0de94d7307;hpb=f3688be5d3f50cccf204d3d01dcaca1e9db7d4f7;p=spider.git diff --git a/cmd/show/configuration.pl b/cmd/show/configuration.pl index 6f2e1e93..7c3281ea 100644 --- a/cmd/show/configuration.pl +++ b/cmd/show/configuration.pl @@ -9,65 +9,78 @@ my ($self, $line) = @_; my @list = map { uc } split /\s+/, $line; # list of callsigns of nodes my @out; -my @nodes = sort {$a->call cmp $b->call} (DXNode::get_all()); +my @nodes = sort {$a->call cmp $b->call} (Route::Node::get_all()); my $node; my @l; my @val; -push @out, "Node Callsigns"; +push @out, $self->msg('showconf'); if ($list[0] && $list[0] =~ /^NOD/) { - my @ch = sort {$a->call cmp $b->call} DXProt::get_all_ak1a(); + my @ch = sort {$a->call cmp $b->call} DXChannel::get_all_nodes(); my $dxchan; foreach $dxchan (@ch) { @val = sort {$a->call cmp $b->call} grep { $_->dxchan == $dxchan } @nodes; - my $call = $dxchan->call; - $call = "($call)" if $dxchan->here == 0; @l = (); + my $call = $dxchan->call; + $call ||= '???'; + $call = "($call)" unless $dxchan->here; push @l, $call; - my $i = 0; - foreach $call (@val) { - if ($i >= 5) { + foreach my $ref (@val) { + if (@l >= 6) { push @out, sprintf "%-12s %-12s %-12s %-12s %-12s %-12s", @l; @l = (); push @l, ""; - $i = 0; } - my $s = $call->{call}; - $s = sprintf "(%s)", $s if $call->{here} == 0; + my $s = $ref->call; + $s ||= '???'; + $s = sprintf "(%s)", $s unless $ref->here; push @l, $s; - $i++; } + push @l, "" while @l < 6; push @out, sprintf "%-12s %-12s %-12s %-12s %-12s %-12s", @l; } } else { + my $printall; + + $printall = 1 if @list && $list[0] =~ /^ALL/i; + # build up the screen from the Node table foreach $node (@nodes) { - next if scalar @list && !grep $node->call eq $_, @list; + unless ($printall) { + if (@list) { + next unless grep $node->call =~ /^$_/, @list; + } else { + next unless grep $node->dxcc == $_, @main::my_cc; + } + } my $call = $node->call; - $call = "($call)" if $node->here == 0; @l = (); + $call ||= '???'; + $call = "($call)" unless $node->here; push @l, $call; - my $nlist = $node->list; - @val = sort {$a->call cmp $b->call} values %{$nlist}; + @val = sort $node->users; - my $i = 0; - if (@val == 0 && $node->users) { - push @l, sprintf "(%d users)", $node->users; + if (@val == 0 && $node->usercount) { + push @l, sprintf "(%d users)", $node->usercount; } foreach $call (@val) { - if ($i >= 5) { + if (@l >= 6) { push @out, sprintf "%-12s %-12s %-12s %-12s %-12s %-12s", @l; @l = (); push @l, ""; - $i = 0; } - my $s = $call->{call}; - $s = sprintf "(%s)", $s if $call->{here} == 0; + my $uref = Route::User::get($call); + my $s = $call; + if ($uref) { + $s = sprintf "(%s)", $call unless $uref->here; + } else { + $s = "$call?"; + } push @l, $s; - $i++; } + push @l, "" while @l < 6; push @out, sprintf "%-12s %-12s %-12s %-12s %-12s %-12s", @l; } }