try again
[spider.git] / perl / Thingy / Ping.pm
index edcd8fe741927acec6282f0ecd666cd195582ce6..f61aafbe996e375845ef24ff6f2d1c22b1b2c2cf 100644 (file)
@@ -31,7 +31,7 @@ sub gen_Aranea
 {
        my $thing = shift;
        unless ($thing->{Aranea}) {
-               $thing->{Aranea} = Aranea::genmsg($thing, qw(id));
+               $thing->{Aranea} = Aranea::genmsg($thing, qw(id out));
        }
        return $thing->{Aranea};
 }
@@ -47,6 +47,19 @@ sub gen_DXProt
 {
        my $thing = shift;
        my $dxchan = shift;
+       unless ($thing->{DXProt}) {
+               # we need to tease out the nodes out of all of this.
+               # bear in mind that a proxied PC prot node could be in
+               # {user} as well as a true user and also it may not
+               # have originated here.
+
+               my $from = $thing->{user} if Route::Node::get($thing->{user});
+               $from ||= $thing->{origin};
+               my $to = $thing->{touser} if Route::Node::get($thing->{touser});
+               $to ||= $thing->{group};
+               
+               $thing->{DXProt} = DXProt::pc51($to, $from, $thing->{out});
+       }
        return $thing->{DXProt};
 }
 
@@ -85,7 +98,8 @@ sub handle
                } else {
 
                        # it's a reply, look in the ping list for this one
-                       my $ref = $ping{$thing->{id}} || $thing->find;
+                       my $ref = $ping{$thing->{id}} if exists $thing->{id};
+                       $ref ||= $thing->find;
                        if ($ref) {
                                my $t = tv_interval($thing->{t}, [ gettimeofday ]);
                                if (my $dxc = DXChannel::get($thing->{user} || $thing->{origin})) {