Change DXUser->get* to DXUser::get*
[spider.git] / cmd / show / users.pl
1 #
2 # show the users on this cluster from the routing tables
3 #
4 # Copyright (c) 1998 Dirk Koopman G1TLH
5 #
6 #
7 #
8
9 my ($self, $line) = @_;
10 my @list = map { uc } split /\s+/, $line; # list of callsigns of nodes
11 my @out;
12
13 if (@list) {
14         foreach my $call (sort @list) {
15                 my $uref = DXUser::get_current($call);
16                 if ($uref) {
17                         my $name = $uref->name || '?';
18                         my $qth = $uref->qth || '?';
19                         my $qra = $uref->qra || '';
20                         my $route = '';
21                         if (my $rref = Route::get($call)) {
22                                 $route = '(at ' . join(',', $rref->parents) . ')';
23                         }
24                         push @out, "$call $route $name $qth $qra",
25                 } else {
26                         push @out, $self->msg('usernf', $call);
27                 }
28         }
29 } else {
30         my $node = $main::routeroot;
31         push @out, join(' ', $self->msg('userconn'), $main::mycall);
32         my $call;
33         my @l;
34         my @val = sort $node->users;
35         foreach $call (@val) {
36                 if (@l >= 5) {
37                         push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l;
38                         @l = ();
39                 }
40                 my $uref = Route::User::get($call);
41                 my $s = $call;
42                 if ($uref) {
43                         $s = sprintf "(%s)", $call unless $uref->here;
44                 } else {
45                         $s = "$call?";
46                 }
47                 push @l, $s;
48         }
49         push @l, "" while @l < 5;
50         push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l;
51 }
52
53 return (1, @out);
54