X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fusers.pl;h=c9df4d6943a785545c1a66a6902f3c1c21f89003;hb=679037f49e292b15a73dce96699c15b9e3049711;hp=8cbe85770967388f43a8895c590f629f2930345b;hpb=2546ef0cfaaca39e65985e414258071a636979af;p=spider.git diff --git a/cmd/show/users.pl b/cmd/show/users.pl index 8cbe8577..c9df4d69 100644 --- a/cmd/show/users.pl +++ b/cmd/show/users.pl @@ -7,32 +7,48 @@ # my ($self, $line) = @_; -my @list = map { uc } split /\s+/, $line; # list of callsigns of nodes +my @list = map { uc } split /\s+/, $line; # list of callsigns of nodes my @out; -my $node = (DXNode->get($main::mycall)); -push @out, "Callsigns connected to $main::mycall"; -my $call; -my $i = 0; -my @l; -my $nlist = $node->list; -my @val = values %{$nlist}; -foreach $call (@val) { - if (@list) { - next if !grep $call->call eq $_, @list; - } - if ($i >= 5) { - push @out, sprintf "%-12s %-12s %-12s %-12s %-12s %-12s", @l; - @l = (); - $i = 0; - } - my $s = $call->{call}; - $s = sprintf "(%s)", $s if $call->{here} == 0; - push @l, $s; - $i++; +if (@list) { + foreach my $call (sort @list) { + my $uref = DXUser->get_current($call); + if ($uref) { + my $name = $uref->name || '?'; + my $qth = $uref->qth || '?'; + my $qra = $uref->qra || ''; + my $route = ''; + if (my $rref = Route::get($call)) { + $route = '(at ' . join(',', $rref->parents) . ')'; + } + push @out, "$call $route $name $qth $qra", + } else { + push @out, $self->msg('usernf', $call); + } + } +} else { + my $node = $main::routeroot; + push @out, join(' ', $self->msg('userconn'), $main::mycall); + my $call; + my @l; + my @val = sort $node->users; + foreach $call (@val) { + if (@l >= 5) { + push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l; + @l = (); + } + my $uref = Route::User::get($call); + my $s = $call; + if ($uref) { + $s = sprintf "(%s)", $call unless $uref->here; + } else { + $s = "$call?"; + } + push @l, $s; + } + push @l, "" while @l < 5; + push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l; } -push @out, sprintf "%-12s %-12s %-12s %-12s %-12s %-12s", @l; - return (1, @out);