add an RBN line to progress
[spider.git] / perl / DXProtHandle.pm
index b3278d36a78a835405f2a72bf8adf68d4e7a142f..f5b7508b6300d8ad38835bf58657daf52a2c30e4 100644 (file)
@@ -252,7 +252,7 @@ sub handle_11
                        my $long = $user->long;
                        if (defined $lat && defined $long) {
                                $user->qra(DXBearing::lltoqra($lat, $long));
-                               $user->put;
+                               $user->put unless $self->{_nospawn};
                        }
                }
 
@@ -285,7 +285,7 @@ sub handle_11
                                        }
                                }
                                $user->lastoper($main::systime);
-                               $user->put;
+                               $user->put unless $self->{_nospawn};
                        }
                }
        }
@@ -512,7 +512,7 @@ sub handle_16
                $user->homenode($parent->call) if !$user->homenode;
                $user->node($parent->call);
                $user->lastin($main::systime) unless DXChannel::get($call);
-               $user->put;
+               $user->put unless $self->{_nospawn};
 
                # send info to all logged in thingies
                $self->tell_login('loginu', "$ncall: $call") if $user->is_local_node;
@@ -628,7 +628,7 @@ sub handle_18
                unless ($self->is_spider) {
                        dbg("Change U " . $self->user->sort . " C $self->{sort} -> S");
                        $self->user->sort('S');
-                       $self->user->put;
+                       $self->user->put unless $self->{_nospawn};
                        $self->sort('S');
                }
 #              $self->{handle_xml}++ if DXXml::available() && $pc->[1] =~ /\bxml/;
@@ -662,7 +662,10 @@ sub check_add_node
        my $call = shift;
 
        # add this station to the user database, if required (don't remove SSID from nodes)
-       my $user = DXUser::get_current($call);
+       my $chan = DXChannel::get($call);
+       my $user;
+       $user = $chan->user if $chan;
+       $user ||= DXUser::get($call);
        unless ($user) {
                $user = DXUser->new($call);
                $user->priv(1);         # I have relented and defaulted nodes
@@ -671,7 +674,7 @@ sub check_add_node
                $user->node($call);
                $user->sort('A');
                $user->lastin($main::systime); # this make it last longer than just this invocation
-               $user->put;                             # just to make sure it gets written away!!!
+               $user->put unless $chan && $chan->{_nospawn};                           # just to make sure it gets written away!!!
        }
        return $user;
 }
@@ -800,7 +803,7 @@ sub handle_19
                $mref->stop_msg($call) if $mref;
 
                $user->lastin($main::systime) unless DXChannel::get($call);
-               $user->put;
+               $user->put unless $self->{_nospawn};
        }
 
        # we are not automatically sending out PC19s, we send out a composite PC21,PC19 instead
@@ -1234,7 +1237,7 @@ sub handle_41
                }
        }
        $user->lastoper($main::systime); # to cut down on excessive for/opers being generated
-       $user->put;
+       $user->put unless $self->{_nospawn};
 
        unless ($self->{isolate}) {
                DXChannel::broadcast_nodes($line, $self); # send it to everyone but me
@@ -1489,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;
 }