- if ($is_node) {
- dbg("ROUTE: added node $call to " . $parent->call) if isdbg('routelow');
- @rout = $parent->add($call, $version, Route::here($here));
- my $r = Route::Node::get($call);
- $r->PC92C_dxchan($dxchan->call, $hops) if $r;
- } else {
- dbg("ROUTE: added user $call to " . $parent->call) if isdbg('routelow');
- @rout = $parent->add_user($call, Route::here($here));
- $dxchan->tell_buddies('loginb', $call, $parent->call) if $dxchan;
- }
- if ($pc92_slug_changes && $parent == $main::routeroot) {
- $things_add{$call} = Route::get($call);
- delete $things_del{$call};
+ my $ncall = $parent->call;
+ if ($ncall ne $call) {
+ my $user;
+ unless (DXChannel::get($call)) { # i.e. external entity - create an user entry for it - ALL entities will appear in ALL user files from now on.
+ $user = DXUser::get($call);
+ unless ($user) {
+ $user = DXUser->new($call);
+ dbg("PCProt::_add_thingy new user $call");
+ }
+ }
+ if ($is_node) {
+ dbg("ROUTE: added node $call to $ncall") if isdbg('routelow');
+ @rout = $parent->add($call, $version, Route::here($here), $ip);
+ my $r = Route::Node::get($call);
+ $r->PC92C_dxchan($dxchan->call, $hops) if $r;
+ if ($ip) {
+ $r->ip($ip);
+ Log('DXProt', "PC92A $call -> $ip on $ncall");
+ }
+ if ($user && $user->sort eq 'U') {
+ if (defined $version) {
+ if ($version >= 5455 && $build > 0 || $version >= 3000 ) {
+ $user->sort('S');
+ } else {
+ $user->sort('A');
+ }
+ dbg("PCProt::_add_thingy node $call sort updated " . $user->sort15);
+ }
+ }
+ } else {
+ dbg("ROUTE: added user $call to $ncall") if isdbg('routelow');
+ my $user = check_add_node($call, 'U');
+ @rout = $parent->add_user($call, Route::here($here), $ip);
+ $dxchan->tell_buddies('loginb', $call, $ncall) if $dxchan;
+ my $r = Route::User::get($call);
+ if ($ip) {
+ $r->ip($ip);
+ Log('DXProt', "PC92A $call -> $ip on $ncall");
+ }
+ }
+ if ($pc92_slug_changes && $parent == $main::routeroot) {
+ $things_add{$call} = Route::get($call);
+ delete $things_del{$call};
+ }
+ $user->close($main::systime, $ip) if $user; # this just updates lastseen and the connlist list containing the IP address
+ } else {
+ dbgprintring(10) if isdbg('nologchan');
+ dbg("DXProt::add_thingy: Trying to add parent $call to itself $ncall, ignored");