- 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;
+ my $r;
+
+ # normalise call, delete any unnormalised calls in the users file.
+ # then ignore this thingy
+ my $normcall = normalise_call($call);
+ if ($normcall ne $call) {
+ next if DXChannel::get($call);
+ $user = DXUser::get($call);
+ dbg("DXProt::_add_thingy call $call normalised to $normcall, deleting spurious user $call");
+ $user->del if $user;
+ $call = $normcall; # this is safe because a route add will ignore duplicates
+ }
+
+ if ($is_node) {
+ dbg("ROUTE: added node $call to $ncall") if isdbg('routelow');
+ $user = check_add_user($call, 'A');
+ @rout = $parent->add($call, $version, Route::here($here), $ip);
+ $r = Route::Node::get($call);
+ $r->PC92C_dxchan($dxchan->call, $hops) if $r;
+ if ($version && is_numeric($version) && !$r->K && !$user->K) {
+ my $old = $user->sort;
+ if ($user->is_ak1a && (($version >= 5455 && $build > 0) || ($version >= 3000 && $version <= 3500)) ) {
+ $user->sort('S');
+ dbg("PCProt::_add_thingy node $call v: $version b: $build sort ($old) updated to " . $user->sort);
+ } elsif ($user->is_spider && ($version < 3000 || ($version > 4000 && $version < 5455))) {
+ unless ($version == 5000 && $build == 0) {
+ $user->sort('A');
+ $build //= 0;
+ dbg("PCProt::_add_thingy node $call v: $version b: $build sort ($old) downgraded to " . $user->sort);
+ }
+ }
+ }
+ $r->version($user->version) if $user->version;
+ $r->build($user->build) if $user->build;
+ $r->K(1) if $user->K;
+ } else {
+ dbg("ROUTE: added user $call to $ncall") if isdbg('routelow');
+ $user = check_add_user($call, 'U', $parent->call);
+ @rout = $parent->add_user($call, Route::here($here), $ip);
+ $dxchan->tell_buddies('loginb', $call, $ncall) if $dxchan;
+ $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");