]> dxcluster.net Git - spider.git/blob - cmd/stat/route.pl
move stuff around and try to get pc59 handling/generation more correct
[spider.git] / cmd / stat / route.pl
1 #
2 # show a Route::Node thingy
3 #
4 # Copyright (c) 2001 Dirk Koopman G1TLH
5 #
6 # $Id$
7 #
8
9 my ($self, $line) = @_;
10 my @out;
11 my @list = split /\s+/, $line;                # generate a list of callsigns
12 @list = ($self->call) if !@list;  # my channel if no callsigns
13 if ($self->priv > 5 && @list && uc $list[0] eq 'ALL') {
14         push @out, "Callsigns in Routing Table";
15         @list =  Route::get_all();
16         my ($ncount, $ucount);
17         my $n = int $self->width / 12;
18         $n ||= 6;
19         while (@list > $n) {
20                 push @out, join(' ', map {
21                         $ncount++ if $_->isa('Route::Node'); 
22                         $ucount++ if $_->isa('Route::User'); 
23                         sprintf "%9s/%s",$_->call,$_->isa('Route::Node') ? 'N':'U' 
24                 } splice(@list, 0, $n));
25         } 
26         push @out, join(' ', map {
27                 $ncount++ if $_->isa('Route::Node'); 
28                 $ucount++ if $_->isa('Route::User'); 
29                 sprintf "%9s/%s",$_->call,$_->isa('Route::Node') ? 'N':'U' 
30         } @list) if @list;
31         push @out, "$ncount Nodes $ucount Users";
32         return (1, @out);
33 }
34
35 my $call;
36 foreach $call (@list) {
37   $call = uc $call;
38   my $ref = Route::get($call);
39   if ($ref) {
40         my $sort = ref $ref;      
41     @out = print_all_fields($self, $ref, "$sort Information $call");
42   } else {
43     push @out, "Route::Node: $call not found";
44   }
45   push @out, "" if @list > 1;
46 }
47
48 return (1, @out);