mirror of
git://scm.dxcluster.org/scm/spider
synced 2024-09-21 07:47:10 +00:00
Merge branch 'ip_address'
Add ip addresses to PC92 A records Conflicts: perl/Version.pm
This commit is contained in:
commit
ca46fb0822
2
Changes
2
Changes
@ -1,3 +1,5 @@
|
|||||||
|
26Nov09=======================================================================
|
||||||
|
1. add ip address to PC92 A records
|
||||||
25Nov09=======================================================================
|
25Nov09=======================================================================
|
||||||
1. Change sh/qrz to use the xml interface. You will have to subscribe to
|
1. Change sh/qrz to use the xml interface. You will have to subscribe to
|
||||||
the xml interface - see http://www.qrz.com/XML/index.html for more info.
|
the xml interface - see http://www.qrz.com/XML/index.html for more info.
|
||||||
|
@ -65,7 +65,7 @@ sub new
|
|||||||
my $pkg = shift;
|
my $pkg = shift;
|
||||||
my $call = shift;
|
my $call = shift;
|
||||||
# my @rout = $main::routeroot->add_user($call, Route::here(1));
|
# my @rout = $main::routeroot->add_user($call, Route::here(1));
|
||||||
DXProt::_add_thingy($main::routeroot, [$call, 0, 0, 1]);
|
DXProt::_add_thingy($main::routeroot, [$call, 0, 0, 1, undef, undef, $self->{conn}->peerhost], );
|
||||||
|
|
||||||
# ALWAYS output the user
|
# ALWAYS output the user
|
||||||
my $ref = Route::User::get($call);
|
my $ref = Route::User::get($call);
|
||||||
@ -89,7 +89,7 @@ sub start
|
|||||||
my $name = $user->{name};
|
my $name = $user->{name};
|
||||||
|
|
||||||
# log it
|
# log it
|
||||||
my $host = $self->{conn}->{peerhost};
|
my $host = $self->{conn}->peerhost;
|
||||||
$host ||= "AGW Port #$self->{conn}->{agwport}" if exists $self->{conn}->{agwport};
|
$host ||= "AGW Port #$self->{conn}->{agwport}" if exists $self->{conn}->{agwport};
|
||||||
$host ||= "unknown";
|
$host ||= "unknown";
|
||||||
LogDbg('DXCommand', "$call connected from $host");
|
LogDbg('DXCommand', "$call connected from $host");
|
||||||
|
@ -269,7 +269,7 @@ sub new
|
|||||||
my @rout = $ref->delete;
|
my @rout = $ref->delete;
|
||||||
$self->route_pc21($main::mycall, undef, @rout) if @rout;
|
$self->route_pc21($main::mycall, undef, @rout) if @rout;
|
||||||
}
|
}
|
||||||
$main::routeroot->add($call, '5000', Route::here(1)) if $call ne $main::mycall;
|
$main::routeroot->add($call, '5000', Route::here(1), $self->{conn}->peerhost) if $call ne $main::mycall;
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ sub start
|
|||||||
my $user = $self->{user};
|
my $user = $self->{user};
|
||||||
|
|
||||||
# log it
|
# log it
|
||||||
my $host = $self->{conn}->{peerhost};
|
my $host = $self->{conn}->peerhost;
|
||||||
$host ||= "AGW Port #$self->{conn}->{agwport}" if exists $self->{conn}->{agwport};
|
$host ||= "AGW Port #$self->{conn}->{agwport}" if exists $self->{conn}->{agwport};
|
||||||
$host ||= "unknown";
|
$host ||= "unknown";
|
||||||
|
|
||||||
|
@ -1353,7 +1353,10 @@ sub _decode_pc92_call
|
|||||||
my $is_node = $flag & 4;
|
my $is_node = $flag & 4;
|
||||||
my $is_extnode = $flag & 2;
|
my $is_extnode = $flag & 2;
|
||||||
my $here = $flag & 1;
|
my $here = $flag & 1;
|
||||||
return ($call, $is_node, $is_extnode, $here, $part[1], $part[2]);
|
my $ip = $part[3];
|
||||||
|
$ip ||= $part[1] if $part[1] && ($part[1] =~ /^(?:\d+\.)+/ || $part[1] =~ /^(?:(?:[abcdef\d]+)?,)+/);
|
||||||
|
$ip =~ s/,/:/g if $ip;
|
||||||
|
return ($call, $is_node, $is_extnode, $here, $part[1], $part[2], $ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
# decode a pc92 call: flag call : version : build
|
# decode a pc92 call: flag call : version : build
|
||||||
@ -1364,7 +1367,7 @@ sub _encode_pc92_call
|
|||||||
# plain call or value
|
# plain call or value
|
||||||
return $ref unless ref $ref;
|
return $ref unless ref $ref;
|
||||||
|
|
||||||
my $ext = shift;
|
my $ext = shift || 0;
|
||||||
my $flag = 0;
|
my $flag = 0;
|
||||||
my $call = $ref->call;
|
my $call = $ref->call;
|
||||||
my $extra = '';
|
my $extra = '';
|
||||||
@ -1373,14 +1376,17 @@ sub _encode_pc92_call
|
|||||||
$flag |= 4;
|
$flag |= 4;
|
||||||
my $dxchan = DXChannel::get($call);
|
my $dxchan = DXChannel::get($call);
|
||||||
$flag |= 2 if $call ne $main::mycall && $dxchan && !$dxchan->{do_pc9x};
|
$flag |= 2 if $call ne $main::mycall && $dxchan && !$dxchan->{do_pc9x};
|
||||||
if ($ext) {
|
if (($ext & 1) && $ref->version) {
|
||||||
if ($ref->version) {
|
my $version = $ref->version || 1.0;
|
||||||
my $version = $ref->version || 1.0;
|
$version = $version * 100 + 5300 if $version < 50;
|
||||||
$version = $version * 100 + 5300 if $version < 50;
|
$extra .= ":" . $version;
|
||||||
$extra .= ":" . $version;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (($ext & 2) && $ref->ip) {
|
||||||
|
my $ip = $ref->ip;
|
||||||
|
$ip =~ s/:/,/g;
|
||||||
|
$extra .= ':' . $ip;
|
||||||
|
}
|
||||||
return "$flag$call$extra";
|
return "$flag$call$extra";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1394,19 +1400,29 @@ sub _add_thingy
|
|||||||
my $dxchan = shift;
|
my $dxchan = shift;
|
||||||
my $hops = shift;
|
my $hops = shift;
|
||||||
|
|
||||||
my ($call, $is_node, $is_extnode, $here, $version, $build) = @$s;
|
my ($call, $is_node, $is_extnode, $here, $version, $build, $ip) = @$s;
|
||||||
my @rout;
|
my @rout;
|
||||||
|
|
||||||
if ($call) {
|
if ($call) {
|
||||||
|
my $ncall = $parent->call;
|
||||||
if ($is_node) {
|
if ($is_node) {
|
||||||
dbg("ROUTE: added node $call to " . $parent->call) if isdbg('routelow');
|
dbg("ROUTE: added node $call to $ncall") if isdbg('routelow');
|
||||||
@rout = $parent->add($call, $version, Route::here($here));
|
@rout = $parent->add($call, $version, Route::here($here), $ip);
|
||||||
my $r = Route::Node::get($call);
|
my $r = Route::Node::get($call);
|
||||||
$r->PC92C_dxchan($dxchan->call, $hops) if $r;
|
$r->PC92C_dxchan($dxchan->call, $hops) if $r;
|
||||||
|
if ($ip) {
|
||||||
|
$r->ip($ip);
|
||||||
|
Log('DXProt', "PC92A $call -> $ip on $ncall");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dbg("ROUTE: added user $call to " . $parent->call) if isdbg('routelow');
|
dbg("ROUTE: added user $call to $ncall") if isdbg('routelow');
|
||||||
@rout = $parent->add_user($call, Route::here($here));
|
@rout = $parent->add_user($call, Route::here($here), $ip);
|
||||||
$dxchan->tell_buddies('loginb', $call, $parent->call) if $dxchan;
|
$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) {
|
if ($pc92_slug_changes && $parent == $main::routeroot) {
|
||||||
$things_add{$call} = Route::get($call);
|
$things_add{$call} = Route::get($call);
|
||||||
|
@ -385,7 +385,7 @@ sub _gen_pc92
|
|||||||
}
|
}
|
||||||
for (@_) {
|
for (@_) {
|
||||||
$s .= '^' . _encode_pc92_call($_, $ext);
|
$s .= '^' . _encode_pc92_call($_, $ext);
|
||||||
$ext = 0; # only the first slot has an ext.
|
$ext = 0 unless $sort eq 'A'; # only the first slot has an ext.
|
||||||
}
|
}
|
||||||
return $s . '^H99^';
|
return $s . '^H99^';
|
||||||
}
|
}
|
||||||
@ -410,7 +410,7 @@ sub gen_pc92_with_time
|
|||||||
# add a local one
|
# add a local one
|
||||||
sub pc92a
|
sub pc92a
|
||||||
{
|
{
|
||||||
return _gen_pc92('A', 0, @_);
|
return _gen_pc92('A', 2, @_);
|
||||||
}
|
}
|
||||||
|
|
||||||
# delete a local one
|
# delete a local one
|
||||||
|
13
perl/Msg.pm
13
perl/Msg.pm
@ -193,6 +193,16 @@ sub pid_gone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub peerhost
|
||||||
|
{
|
||||||
|
my $self = shift;
|
||||||
|
my $ip;
|
||||||
|
unless ($self->{peerhost}) {
|
||||||
|
$self->{peerhost} = $self->{sock}->peerhost;
|
||||||
|
}
|
||||||
|
return $self->{peerhost};
|
||||||
|
}
|
||||||
|
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# Send side routines
|
# Send side routines
|
||||||
sub connect {
|
sub connect {
|
||||||
@ -225,7 +235,8 @@ sub connect {
|
|||||||
return undef unless $r || _err_will_block($!);
|
return undef unless $r || _err_will_block($!);
|
||||||
|
|
||||||
$conn->{sock} = $sock;
|
$conn->{sock} = $sock;
|
||||||
|
$conn->{peerhost} = $sock->peerhost; # for consistency
|
||||||
|
|
||||||
if ($conn->{rproc}) {
|
if ($conn->{rproc}) {
|
||||||
my $callback = sub {$conn->_rcv};
|
my $callback = sub {$conn->_rcv};
|
||||||
set_event_handler ($sock, read => $callback);
|
set_event_handler ($sock, read => $callback);
|
||||||
|
@ -33,6 +33,7 @@ use vars qw(%list %valid @ISA $max $filterdef $obscount);
|
|||||||
obscount => '0,Obscount',
|
obscount => '0,Obscount',
|
||||||
last_PC92C => '9,Last PC92C',
|
last_PC92C => '9,Last PC92C',
|
||||||
PC92C_dxchan => '9,Channel of PC92C,phash',
|
PC92C_dxchan => '9,Channel of PC92C,phash',
|
||||||
|
ip => '0,IP Address',
|
||||||
);
|
);
|
||||||
|
|
||||||
$filterdef = $Route::filterdef;
|
$filterdef = $Route::filterdef;
|
||||||
@ -166,6 +167,8 @@ sub add_user
|
|||||||
{
|
{
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $ucall = shift;
|
my $ucall = shift;
|
||||||
|
my $here = shift;
|
||||||
|
my $ip = shift;
|
||||||
|
|
||||||
confess "Trying to add NULL User call to routing tables" unless $ucall;
|
confess "Trying to add NULL User call to routing tables" unless $ucall;
|
||||||
|
|
||||||
@ -174,7 +177,7 @@ sub add_user
|
|||||||
if ($uref) {
|
if ($uref) {
|
||||||
@out = $uref->addparent($self);
|
@out = $uref->addparent($self);
|
||||||
} else {
|
} else {
|
||||||
$uref = Route::User->new($ucall, $self->{call}, @_);
|
$uref = Route::User->new($ucall, $self->{call}, $here, $ip);
|
||||||
@out = $uref;
|
@out = $uref;
|
||||||
}
|
}
|
||||||
$self->_adduser($uref);
|
$self->_adduser($uref);
|
||||||
@ -281,6 +284,8 @@ sub new
|
|||||||
$self->{users} = [];
|
$self->{users} = [];
|
||||||
$self->{nodes} = [];
|
$self->{nodes} = [];
|
||||||
$self->{PC92C_dxchan} = {};
|
$self->{PC92C_dxchan} = {};
|
||||||
|
my $ip = shift;
|
||||||
|
$self->{ip} = $ip if defined $ip;
|
||||||
$self->reset_obs; # by definition
|
$self->reset_obs; # by definition
|
||||||
|
|
||||||
$list{$call} = $self;
|
$list{$call} = $self;
|
||||||
|
@ -19,6 +19,7 @@ use vars qw(%list %valid @ISA $max $filterdef);
|
|||||||
|
|
||||||
%valid = (
|
%valid = (
|
||||||
parent => '0,Parent Calls,parray',
|
parent => '0,Parent Calls,parray',
|
||||||
|
ip => '0,IP Address',
|
||||||
);
|
);
|
||||||
|
|
||||||
$filterdef = $Route::filterdef;
|
$filterdef = $Route::filterdef;
|
||||||
@ -44,11 +45,14 @@ sub new
|
|||||||
my $call = uc shift;
|
my $call = uc shift;
|
||||||
my $ncall = uc shift;
|
my $ncall = uc shift;
|
||||||
my $flags = shift;
|
my $flags = shift;
|
||||||
|
my $ip = shift;
|
||||||
|
|
||||||
confess "already have $call in $pkg" if $list{$call};
|
confess "already have $call in $pkg" if $list{$call};
|
||||||
|
|
||||||
my $self = $pkg->SUPER::new($call);
|
my $self = $pkg->SUPER::new($call);
|
||||||
$self->{parent} = [ $ncall ];
|
$self->{parent} = [ $ncall ];
|
||||||
$self->{flags} = $flags || Route::here(1);
|
$self->{flags} = $flags || Route::here(1);
|
||||||
|
$self->{ip} = $ip if defined $ip;
|
||||||
$list{$call} = $self;
|
$list{$call} = $self;
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -11,6 +11,6 @@ use vars qw($version $subversion $build);
|
|||||||
|
|
||||||
$version = '';
|
$version = '';
|
||||||
$subversion = '0';
|
$subversion = '0';
|
||||||
$build = '1';
|
$build = '57';
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -175,7 +175,7 @@ sub new_channel
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($bumpexisting) {
|
if ($bumpexisting) {
|
||||||
my $ip = $conn->{peerhost} || 'unknown';
|
my $ip = $conn->peerhost || 'unknown';
|
||||||
$dxchan->send_now('D', DXM::msg($lang, 'conbump', $call, $ip));
|
$dxchan->send_now('D', DXM::msg($lang, 'conbump', $call, $ip));
|
||||||
LogDbg('DXCommand', "$call bumped off by $ip, disconnected");
|
LogDbg('DXCommand', "$call bumped off by $ip, disconnected");
|
||||||
$dxchan->disconnect;
|
$dxchan->disconnect;
|
||||||
@ -208,7 +208,7 @@ sub new_channel
|
|||||||
my $lock = $user->lockout if $user;
|
my $lock = $user->lockout if $user;
|
||||||
if ($baseuser && $baseuser->lockout || $lock) {
|
if ($baseuser && $baseuser->lockout || $lock) {
|
||||||
if (!$user || !defined $lock || $lock) {
|
if (!$user || !defined $lock || $lock) {
|
||||||
my $host = $conn->{peerhost} || "unknown";
|
my $host = $conn->peerhost || "unknown";
|
||||||
LogDbg('DXCommand', "$call on $host is locked out, disconnected");
|
LogDbg('DXCommand', "$call on $host is locked out, disconnected");
|
||||||
$conn->disconnect;
|
$conn->disconnect;
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user