X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FThingy%2FPing.pm;h=c8bf3a610c7dbc8db8c6dbce37cc3fbeea1a889b;hb=eb09664039fe464e8aee4e9d921be96fb28b95e4;hp=60c68078452abdec6529be9c6d3094ce3f490f72;hpb=b051574851d84df8da1e17965cb50bb1a05a173e;p=spider.git diff --git a/perl/Thingy/Ping.pm b/perl/Thingy/Ping.pm index 60c68078..c8bf3a61 100644 --- a/perl/Thingy/Ping.pm +++ b/perl/Thingy/Ping.pm @@ -55,10 +55,11 @@ sub gen_DXProt # {user} as well as a true user and also it may not # have originated here. - my $from = $thing->{o}; + my $from = $thing->{o} if $thing->{out}; $from ||= $thing->{user} if Route::Node::get($thing->{user}); $from ||= $thing->{origin}; - my $to = $thing->{touser} if Route::Node::get($thing->{touser}); + my $to = $thing->{o} unless $thing->{out}; + $to ||= $thing->{touser} if Route::Node::get($thing->{touser}); $to ||= $thing->{group}; @@ -71,8 +72,7 @@ sub gen_DXCommandmode { my $thing = shift; my $dxchan = shift; - my $buf; - + my $buf = $dxchan->msg('pingi', ($thing->{user} || $thing->{origin}), $thing->{ft}, $thing->{fave}); return $buf; } @@ -82,12 +82,13 @@ sub from_DXProt my $thing = ref $_[0] ? shift : $_[0]->SUPER::new(origin=>$main::mycall); my $dxchan = shift; $thing->{DXProt} = shift; + shift; # PC51 $thing->{group} = shift; # to call my $from = shift; $thing->{out} = shift; # 1 = ping, 0 = pong; $thing->{user} = $dxchan->{call}; $thing->{o} = $from unless $from eq $dxchan->{call}; - $thing->remember if $thing->{out}; + $thing->remember if $thing->{out} && $thing->{group} ne $main::mycall; return $thing; } @@ -131,11 +132,9 @@ sub handle $tochan->{nopings} = $nopings; # pump up the timer } if (my $dxc = DXChannel::get($ref->{user} || $ref->{origin})) { - if ($dxc->is_user) { - my $s = sprintf "%.2f", $t; - my $ave = sprintf "%.2f", $tochan ? ($tochan->{pingave} || $t) : $t; - $dxc->send($dxc->msg('pingi', ($ref->{touser} || $ref->{group}), $s, $ave)) - } + $thing->{ft} = sprintf "%.2f", $t; + $thing->{fave} = sprintf "%.2f", $tochan ? ($tochan->{pingave} || $t) : $t; + $thing->send($dxc); } delete $ping{$ref->{id}}; }