X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FThingy%2FPing.pm;fp=perl%2FThingy%2FPing.pm;h=60c68078452abdec6529be9c6d3094ce3f490f72;hb=b051574851d84df8da1e17965cb50bb1a05a173e;hp=02fc5cef51bea6caf1176bce93e4a98d4729d08a;hpb=c3ba5929db3bd5343ae4ac17c4420155745be511;p=spider.git diff --git a/perl/Thingy/Ping.pm b/perl/Thingy/Ping.pm index 02fc5cef..60c68078 100644 --- a/perl/Thingy/Ping.pm +++ b/perl/Thingy/Ping.pm @@ -22,10 +22,12 @@ use Spot; use Time::HiRes qw(gettimeofday tv_interval); -use vars qw(@ISA %ping); +use vars qw(@ISA %ping $ping_ttl); @ISA = qw(Thingy); my $id; +$ping_ttl = 300; # default ping ttl + sub gen_Aranea { @@ -74,14 +76,18 @@ sub gen_DXCommandmode return $buf; } +# called with the dxchan, line and the split out arguments sub from_DXProt { - my $thing = ref $_[0] ? shift : $_[0]->SUPER::new(); - - while (@_) { - my $k = shift; - $thing->{$k} = shift; - } + my $thing = ref $_[0] ? shift : $_[0]->SUPER::new(origin=>$main::mycall); + my $dxchan = shift; + $thing->{DXProt} = shift; + $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}; return $thing; }