X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FThingy%2FPing.pm;h=de295c556c939909dbe062793842867e9942ba2a;hb=7f8810e2112b1fa4a68472c265a71906e7dcccd3;hp=c8bf3a610c7dbc8db8c6dbce37cc3fbeea1a889b;hpb=eb09664039fe464e8aee4e9d921be96fb28b95e4;p=spider.git diff --git a/perl/Thingy/Ping.pm b/perl/Thingy/Ping.pm index c8bf3a61..de295c55 100644 --- a/perl/Thingy/Ping.pm +++ b/perl/Thingy/Ping.pm @@ -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; } @@ -108,8 +117,9 @@ sub handle } else { # it's a reply, look in the ping list for this one - my $ref = $ping{$thing->{id}} if exists $thing->{id}; - $ref ||= find(($thing->{user}||$thing->{origin}), ($thing->{touser}||$thing->{group})); + my $ref; + $ref = $ping{$thing->{id}} if exists $thing->{id}; + $ref = find(($thing->{user}||$thing->{origin}), ($thing->{touser}||$thing->{group})) unless $ref; if ($ref) { my $t = tv_interval($ref->{t}, [ gettimeofday ]); my $tochan = DXChannel::get($ref->{touser} || $ref->{group}); @@ -140,7 +150,6 @@ sub handle } } } else { - $thing->{route} = $thing->{o} if $thing->{o}; $thing->broadcast($dxchan); } }