X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FRoute%2FNode.pm;h=e7b18772eadeb0bc91fb99066de18ea40161ceb4;hb=a9072bdb10a67ad28edda787cbf38018356b2db5;hp=d46733bbcdf295e05aafd649e34262e688fd904a;hpb=320d95463f2d936e627e485702949c9cee704d0b;p=spider.git diff --git a/perl/Route/Node.pm b/perl/Route/Node.pm index d46733bb..e7b18772 100644 --- a/perl/Route/Node.pm +++ b/perl/Route/Node.pm @@ -58,7 +58,7 @@ sub max # object with that callsign. The upper layers are expected to do something # sensible with this! # -# called as $parent->add(call, dxchan, version, flags) +# called as $parent->add(call, version, flags) # sub add @@ -66,13 +66,21 @@ sub add my $parent = shift; my $call = uc shift; confess "Route::add trying to add $call to myself" if $call eq $parent->{call}; + my $version = shift; + my $here = shift; + my $self = get($call); if ($self) { $self->_addparent($parent); $parent->_addnode($self); + if ($self->{version} != $version || $self->{flags} != $here) { + $self->{version} = $version; + $self->{flags} = $here; + return $self; + } return undef; } - $self = $parent->new($call, @_); + $self = $parent->new($call, $version, $here); $parent->_addnode($self); return $self; } @@ -196,6 +204,25 @@ sub parents return @{$self->{parent}}; } +sub has_user +{ + my $self = shift; + return $self->_haslist('users', shift); +} + +sub has_node +{ + my $self = shift; + return $self->_haslist('nodes', shift); +} + +sub has_parent +{ + my $self = shift; + return $self->_haslist('parent', shift); +} + + sub rnodes { my $self = shift; @@ -331,15 +358,6 @@ sub _deluser return $self->_dellist('users', @_); } -sub DESTROY -{ - my $self = shift; - my $pkg = ref $self; - my $call = $self->{call} || "Unknown"; - - dbg("destroying $pkg with $call") if isdbg('routelow'); -} - # # generic AUTOLOAD for accessors #