chop out Investigate code
[spider.git] / perl / Thingy / Ping.pm
index d3fa90f401286f8440ef81328892a304fb6fc3be..0d005e48eccf923d67ddd8b7f1f5922a76fea5e7 100644 (file)
@@ -55,14 +55,20 @@ sub gen_DXProt
                # {user} as well as a true user and also it may not
                # have originated here.
 
-               my $from = $thing->{o} if $thing->{out};
-           $from ||= $thing->{user} if Route::Node::get($thing->{user});
-               $from ||= $thing->{origin};
-               my $to = $thing->{o} unless $thing->{out};
-               $to ||= $thing->{touser} if Route::Node::get($thing->{touser});
-               $to ||= $thing->{group};
-
-               
+               my ($from, $to);
+               if ($thing->{out}) {
+                       $from = $thing->{o};
+                       $from ||= $thing->{user} unless Route::User::get($thing->{user});
+                       $from ||= $thing->{origin};
+                       $to = $thing->{touser} unless Route::User::get($thing->{touser});
+                       $to ||= $thing->{group};
+               } else {
+                       $from ||= $thing->{user} unless Route::User::get($thing->{user});
+                       $from ||= $thing->{origin};
+                       $to = $thing->{o};
+                       $to ||= $thing->{touser} unless Route::User::get($thing->{touser});
+                       $to ||= $thing->{group};
+               }
                $thing->{DXProt} = DXProt::pc51($to, $from, $thing->{out});
        }
        return $thing->{DXProt};
@@ -72,7 +78,10 @@ sub gen_DXCommandmode
 {
        my $thing = shift;
        my $dxchan = shift;
-       my $buf = $dxchan->msg('pingi', ($thing->{user} || $thing->{origin}), $thing->{ft}, $thing->{fave});
+       my $buf;
+       if ($dxchan->{call} eq $thing->{touser}) {
+               $buf = $dxchan->msg('pingi', ($thing->{user} || $thing->{origin}), $thing->{ft}, $thing->{fave});
+       }
        return $buf;
 }