fix the issue in DXProt::add_thingy
[spider.git] / perl / DXProtHandle.pm
index 13305829f3214da57d81dfdae8f3eddef94df79e..f5b7508b6300d8ad38835bf58657daf52a2c30e4 100644 (file)
@@ -1492,30 +1492,36 @@ sub _add_thingy
        
        if ($call) {
                my $ncall = $parent->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 ($ncall ne $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");
+                               }
+                       } else {
+                               dbg("ROUTE: added user $call to $ncall") if isdbg('routelow');
+                               @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");
+                               }
                        }
-               } else {
-                       dbg("ROUTE: added user $call to $ncall") if isdbg('routelow');
-                       @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};
                        }
-               }
-               if ($pc92_slug_changes && $parent == $main::routeroot) {
-                       $things_add{$call} = Route::get($call);
-                       delete $things_del{$call};
+               } else {
+                       dbgprintring(10);
+                       dbg("DXProt::add_thingy: Trying to add parent $call to itself $ncall, ignored");
                }
        }
+       
        return @rout;
 }