From: minima Date: Fri, 6 Jun 2003 13:15:12 +0000 (+0000) Subject: change the placing of adding PC9x headers X-Git-Url: http://dxspider.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fremotes%2Fserver%2FPC90-2;p=spider.git change the placing of adding PC9x headers fix the routing table a bit better --- diff --git a/cmd/show/newconfiguration.pl b/cmd/show/newconfiguration.pl index 66756191..f1f226ea 100644 --- a/cmd/show/newconfiguration.pl +++ b/cmd/show/newconfiguration.pl @@ -16,6 +16,13 @@ if (@list && $list[0] =~ /^NOD/) { shift @list; } -push @out, $main::routeroot->config($nodes_only, 0, [], @list); +# root node +push @out, $main::mycall; + +# now show the config in terms of each of the root nodes view +foreach my $n ($main::routeroot->links) { + my $r = Route::Node::get($n); + push @out, $r->config($nodes_only, 1, [], @list) if $r; +} return (1, @out); diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 76bfa931..2d2b5def 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -552,7 +552,10 @@ sub prompt if ($self->{prompt}) { $self->send($self->{prompt}); } else { - $self->send($self->msg($self->here ? 'pr' : 'pr2', $self->call, cldate($main::systime), ztime($main::systime))); + my $prkey = $self->here ? 'pr' : 'pr2'; + my $mail = DXMsg::for_me($self->call) ? $self->msg('newmail') : ""; + + $self->send($self->msg($prkey, $self->call, cldate($main::systime), ztime($main::systime), $mail)); } } diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 1622728d..5f778207 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -317,7 +317,14 @@ sub send while (@_) { my $line = shift; if ($self->user->wantpc90) { - $line = mungepc90($line); + my ($pcno) = $line =~ /^PC(\d\d)/; + if ($pcno < 90) { + if ($pcno == 16 || $pcno == 17 || $pcno == 19 || $pcno == 21) { + $line = mungepc91($main::mycall, $line); + } else { + $line = mungepc90($line); + } + } } else { removepc91($line); removepc90($line); @@ -434,12 +441,6 @@ sub normal return; } } - } else { - if ($pcno == 16 || $pcno == 17 || $pcno == 19 || $pcno == 21) { - $line = mungepc91($origin, $line); - } else { - $line = mungepc90($line); - } } no strict 'subs'; @@ -1017,7 +1018,9 @@ sub handle_19 # if the origin isn't the same as the INTERFACE, then reparent, creating nodes as necessary if ($origin ne $self->call) { my $op = Route::Node::get($origin); - unless ($op) { + if ($op) { + $parent->add($op) unless $parent->haslink($op); + } else { $op = $parent->add($origin, 5000, Route::here(1)); my $user = DXUser->get_current($origin); if (!$user) { @@ -1160,10 +1163,13 @@ sub handle_21 my $parent = Route::Node::get($self->{call}); unless ($parent) { - dbg("DXPROT: my parent $self->{call} has disappeared"); + dbg("DXPROT: my parent $origin has disappeared"); $self->disconnect; return; } + my $or = Route::Node::get($origin) if $origin ne $self->{call}; + $parent = $or if $or; + if ($call ne $main::mycall) { # don't allow malicious buggers to disconnect me! my $node = Route::Node::get($call); if ($node) { diff --git a/perl/Messages b/perl/Messages index d92efe39..ac355b67 100644 --- a/perl/Messages +++ b/perl/Messages @@ -192,6 +192,7 @@ package DXM; namee1 => 'Please enter your name, set/name ', namee2 => 'Can\'t find user $_[0]!', name => 'Your name is now \"$_[0]\"', + newmail => ' (New Mail)', nodea => '$_[0] set as AK1A style Node', nodeac => '$_[0] created as AK1A style Node', nodeb => '$_[0] set as BBS', @@ -225,8 +226,8 @@ package DXM; pinge1 => 'Cannot ping yourself!', pingint => 'Ping interval on $_[0] set to $_[1] secs', 'pos' => 'From Callsign: $_[0] Lat: $_[1] Long: $_[2]', - pr => '$_[0] de $main::mycall $_[1] $_[2] >', - pr2 => '($_[0]) de $main::mycall $_[1] $_[2] >', + pr => '$_[0] de $main::mycall $_[1] $_[2]$_[3] >', + pr2 => '($_[0]) de $main::mycall $_[1] $_[2]$_[3] >', prs => 'Prompt now set to \"$_[0]\"', pru => 'Prompt now set back to default', priv => 'Privilege level changed on $_[0]', diff --git a/perl/Route.pm b/perl/Route.pm index 79208af4..4e58b02b 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -189,12 +189,20 @@ sub config { my $self = shift; my $nodes_only = shift; - my $level = shift; + my $level = shift || 0; my $seen = shift; my @out; my $line; - my $call = $self->user_call; + my $ucall = $self->user_call; + my $call = $self->{call}; my $printit = 1; + + return if $level > 1 && DXChannel->get($call); + +# my @seen = @$seen || (); +# return if $level > 1 && grep $call eq $_, @seen; +# push @seen, @{$self->{links}}; + # allow ranges if (@_) { @@ -202,55 +210,32 @@ sub config } if ($printit) { - $line = ' ' x ($level*2) . "$call"; - $call = ' ' x length $call; + $line = ' ' x ($level*3) . "$ucall"; + push @out, $line; +# push @$seen, $call; - # recursion detector - if ((DXChannel->get($self->{call}) && $level > 1) || grep $self->{call} eq $_, @$seen) { - $line .= ' ...'; - push @out, $line; - return @out; - } - push @$seen, $self->{call}; - - # print users - unless ($nodes_only) { - if (@{$self->{users}}) { - $line .= '->'; - foreach my $ucall (sort @{$self->{users}}) { - my $uref = Route::User::get($ucall); - my $c; - if ($uref) { - $c = $uref->user_call; - } else { - $c = "$ucall?"; - } - if ((length $line) + (length $c) + 1 < 79) { - $line .= $c . ' '; - } else { - $line =~ s/\s+$//; - push @out, $line; - $line = ' ' x ($level*2) . "$call->$c "; - } + foreach my $ncall (sort @{$self->{links}}) { + my $nref = Route::Node::get($ncall); + + if ($nref) { + my $c = $nref->user_call; + dbg("recursing from $call -> $c (" . (join ',', @$seen) . ")") if isdbg('routec'); + + unless (grep $ncall eq $_, @$seen) { +# push @seen, $call; + push @$seen, $ncall; + push @out, $nref->config($nodes_only, $level+1, $seen, @_); +# pop @$seen; +# pop @seen; + } else { +# $line .= "->$ncall" if $line !~ $ncall; +# push @out, $line; } + } else { + push @out, ' ' x (($level+1)*2) . "$ncall?" if @_ == 0 || (@_ && grep $ncall =~ m|$_|, @_); } } - $line =~ s/->$//g; - $line =~ s/\s+$//; - push @out, $line if length $line; - } - - # deal with more nodes - foreach my $ncall (sort @{$self->{links}}) { - my $nref = Route::Node::get($ncall); - - if ($nref) { - my $c = $nref->user_call; -# dbg("recursing from $call -> $c") if isdbg('routec'); - push @out, $nref->config($nodes_only, $level+1, $seen, @_); - } else { - push @out, ' ' x (($level+1)*2) . "$ncall?" if @_ == 0 || (@_ && grep $ncall =~ m|$_|, @_); - } +# pop @$seen; } return @out; @@ -373,6 +358,13 @@ sub _dellink return $self->_dellist('links', @_); } +sub haslink +{ + my $self = shift; + my $other = shift->{call}; + return grep $other eq $_, @{$self->{links}}; +} + # # track destruction #