fix problems with users on more than one node
[spider.git] / perl / DXProt.pm
index 152a5fe05bdb84510ae764028d57ce59106d0524..460e401a0099b6a9b7f7cc711ffbf33e1116d4c8 100644 (file)
@@ -275,10 +275,8 @@ sub normal
        
 #      print join(',', @field), "\n";
                                                
-       # ignore any lines that don't start with PC
-       return if !$field[0] =~ /^PC/;
        
-       # process PC frames
+       # process PC frames, this will fail unless the frame starts PCnn
        my ($pcno) = $field[0] =~ /^PC(\d\d)/; # just get the number
        return unless $pcno;
        return if $pcno < 10 || $pcno > 99;
@@ -561,10 +559,13 @@ sub normal
                                my $r = Route::User::get($call);
                                my $flags = Route::here($here)|Route::conf($conf);
                                
-                               if ($r && $r->flags != $flags) {
-                                       $r->flags($flags);
-                                       push @rout, $r;
-                               } elsif (!$r) {
+                               if ($r) {
+                                       if ($r->flags != $flags) {
+                                               $r->flags($flags);
+                                               push @rout, $r;
+                                       }
+                                       $r->addparent($ncall);
+                               } else {
                                        push @rout, $parent->add_user($call, $flags);
                                }
                                
@@ -785,16 +786,18 @@ sub normal
                
                if ($pcno == 24) {              # set here status
                        my $call = uc $field[1];
-                       my $ref = Route::Node::get($call);
-                       $ref->here($field[2]) if $ref;
-                       $ref = Route::User::get($call);
-                       $ref->here($field[2]) if $ref;
-                       $ref ||= Route->new($call);
+                       my ($nref, $uref);
+                       $nref = Route::Node::get($call);
+                       $uref = Route::User::get($call);
+                       return unless $nref || $uref;   # if we don't know where they are, it's pointless sending it on
                        
-                       # input filter if required
-                       return unless $self->in_filter_route($ref);
-
-                       $self->route_pc24($ref, $field[3]) if $ref && !eph_dup($line);
+                       unless (eph_dup($line)) {
+                               $nref->here($field[2]) if $nref;
+                               $uref->here($field[2]) if $uref;
+                               my $ref = $nref || $uref;
+                               return unless $self->in_filter_route($ref);
+                               $self->route_pc24($ref, $field[3]);
+                       }
                        return;
                }