add_thingy patch backport from mojo

This commit is contained in:
Dirk Koopman 2020-05-26 22:51:26 +01:00
parent 85db230275
commit 094499a2f2

View File

@ -1420,32 +1420,40 @@ sub _add_thingy
my ($call, $is_node, $is_extnode, $here, $version, $build, $ip) = @$s;
my @rout;
# remove spurious IPV6 prefix on IPV4 addresses
$ip =~ s/^::ffff:// if $ip;
if ($call) {
my $ncall = $parent->call;
if ($is_node) {
dbg("ROUTE: added node $call to $ncall") if isdbg('routelow');
@rout = $parent->add($call, $version, Route::here($here), $ip);
my $r = Route::Node::get($call);
$r->PC92C_dxchan($dxchan->call, $hops) if $r;
if ($ip) {
$r->ip($ip);
Log('DXProt', "PC92A $call -> $ip on $ncall");
if ($ncall ne $call) {
if ($is_node) {
dbg("ROUTE: added node $call to $ncall") if isdbg('routelow');
@rout = $parent->add($call, $version, Route::here($here), $ip);
my $r = Route::Node::get($call);
$r->PC92C_dxchan($dxchan->call, $hops) if $r;
if ($ip) {
$r->ip($ip);
Log('DXProt', "PC92A $call -> $ip on $ncall");
}
} else {
dbg("ROUTE: added user $call to $ncall") if isdbg('routelow');
@rout = $parent->add_user($call, Route::here($here), $ip);
$dxchan->tell_buddies('loginb', $call, $ncall) if $dxchan;
my $r = Route::User::get($call);
if ($ip) {
$r->ip($ip);
Log('DXProt', "PC92A $call -> $ip on $ncall");
}
}
if ($pc92_slug_changes && $parent == $main::routeroot) {
$things_add{$call} = Route::get($call);
delete $things_del{$call};
}
} else {
dbg("ROUTE: added user $call to $ncall") if isdbg('routelow');
@rout = $parent->add_user($call, Route::here($here), $ip);
$dxchan->tell_buddies('loginb', $call, $ncall) if $dxchan;
my $r = Route::User::get($call);
if ($ip) {
$r->ip($ip);
Log('DXProt', "PC92A $call -> $ip on $ncall");
}
}
if ($pc92_slug_changes && $parent == $main::routeroot) {
$things_add{$call} = Route::get($call);
delete $things_del{$call};
dbg("DXProt::add_thingy: Trying to add parent $call to itself $ncall, ignored");
}
}
return @rout;
}