return @out;
}
+sub _haslist
+{
+ my $self = shift;
+ my $field = shift;
+ my @out;
+ my $call = shift;
+ my $r = grep $_->{call} eq $call, @{$self->{$field}};
+ dbg(ref($self) . " $call is " . $r?'in':'NOT in' . " $self->{call}\->\{$field\}") if isdbg('routelow');
+}
+
sub is_empty
{
my $self = shift;
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;
sub addparent
{
my $self = shift;
- return $self->_addlist('parent', @_);
+ return $self->_addlist('parent', shift);
}
sub delparent
{
my $self = shift;
- return $self->_dellist('parent', @_);
+ return $self->_dellist('parent', shift);
+}
+
+sub has_parent
+{
+ my $self = shift;
+ return $self->_haslist('parent', shift);
}
#
my $origin = $thing->{origin};
my $chan_call = $dxchan->{call};
+ my @pc19;
+ my @pc21;
+
my $parent = Route::Node::get($origin);
unless ($parent) {
- dbg("Thingy::Rt::cf: received from $origin on $chan_call unknown") if isdbg('chanerr');
- return;
+ dbg("Thingy::Rt::cf: new (unconnected) node $origin arrived") if isdbg('chanerr');
+ $parent = Route::Node::new($origin, 0, 1);
+ push @pc19, $parent;
}
$parent->np(1);
- my @pc19;
- my @pc21;
-
# move the origin over to the user, if required
if ($thing->{user}) {
$origin = $thing->{user};