X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FThingy%2FHello.pm;h=c098ca944edfb97825184cf8ab6543107826dbf5;hb=87b2f58b1b0df6c0cb5c5f0070db554ec2d2a961;hp=63b352b4f06dcc3bd0474859fbbfeffa6344f3ad;hpb=5764cc1c0f79b56fdf5389d2b0dcb2ab7e54723d;p=spider.git diff --git a/perl/Thingy/Hello.pm b/perl/Thingy/Hello.pm index 63b352b4..c098ca94 100644 --- a/perl/Thingy/Hello.pm +++ b/perl/Thingy/Hello.pm @@ -49,7 +49,9 @@ sub handle my $dxchan = shift; # verify authenticity - if ($dxchan->call eq $thing->{origin}) { + if ($dxchan->{call} eq $thing->{origin}) { + + # for directly connected calls if ($verify_on_login) { my $pp = $dxchan->user->passphrase; unless ($pp) { @@ -71,14 +73,37 @@ sub handle $thing->send($dxchan); } } + } else { + + # for otherwise connected calls, that come in relayed from other nodes + # note that we cannot do any connections at this point + my $nref = Route::Node::get($thing->{origin}); + unless ($nref) { + my $v = $thing->{user} ? undef : $thing->{v}; + $nref = Route::Node->new($thing->{origin}, $v, 1); + } + if (my $user = $thing->{user}) { + my $ur = Route::get($user); + unless ($ur) { + my $uref = DXUser->get_current($user); + if ($uref->is_node || $uref->is_aranea) { + $nref->add($user, $thing->{v}, 1); + } else { + $nref->add_user($user, 1); + } + } + } } + RouteDB::update($thing->{origin}, $dxchan->{call}, $thing->{hopsaway}); + RouteDB::update($thing->{user}, $dxchan->{call}, $thing->{hopsaway}) if $thing->{user}; + $thing->broadcast($dxchan); } sub new { my $pkg = shift; - my $thing = $pkg->SUPER::new(origin=>$main::mycall, group=>'RT'); + my $thing = $pkg->SUPER::new(origin=>$main::mycall); return $thing; } 1;