# convert the date to a unix date
my $d = cltounix($field[3], $field[4]);
- return if !$d || ($pcno == 11 && $d < $main::systime - $pc11_max_age); # bang out (and don't pass on) if date is invalid or the spot is too old
-
+ # bang out (and don't pass on) if date is invalid or the spot is too old
+ if (!$d || ($pcno == 11 && $d < $main::systime - $pc11_max_age)) {
+ dbg('chan', "Spot ignored, invalid date or too old");
+ return;
+ }
+
# strip off the leading & trailing spaces from the comment
my $text = unpad($field[5]);
# do some de-duping
my $dupkey = "$field[1]$field[2]$d$text$field[6]";
- return if $dup{$dupkey};
+ if ($dup{$dupkey}) {
+ dbg('chan', "Duplicate Spot ignored");
+ return;
+ }
+
$dup{$dupkey} = $d;
my $spot = Spot::add($field[1], $field[2], $d, $text, $spotter);
$self->send_local_config();
$self->send(pc20());
$self->state('init');
- last SWITCH;
+ return; # we don't pass these on
}
if ($pcno == 19) { # incoming cluster list
my $node;
foreach $node (@gonenodes) {
- next if $node->call eq $call;
- broadcast_ak1a(pc21($node->call, 'Gone'), $self) unless $self->{isolate}; # done like this 'cos DXNodes don't have a pc21 method
+ next if $node->call eq $call;
+ broadcast_ak1a(pc21($node->call, 'Gone') , $self) unless $self->{isolate};
$node->del();
}
my @s = $me->pc19(@nodes);
for (@s) {
my $routeit = adjust_hops($self, $_);
- $self->send($_) if $routeit;
+ $self->send($routeit) if $routeit;
}
# get all the users connected on the above nodes and send them out
my @s = pc16($n, @users);
for (@s) {
my $routeit = adjust_hops($self, $_);
- $self->send($_) if $routeit;
+ $self->send($routeit) if $routeit;
}
}
}
if ($dxchan) {
my $routeit = adjust_hops($dxchan, $line); # adjust its hop count by node name
if ($routeit) {
- $dxchan->send($line) if $dxchan;
+ $dxchan->send($routeit) if $dxchan;
}
}
}
# send it if it isn't the except list and isn't isolated and still has a hop count
foreach $dxchan (@dxchan) {
next if grep $dxchan == $_, @except;
- my $routeit = adjust_hops($dxchan, $s); # adjust its hop count by node name
- $dxchan->send($s) unless $dxchan->{isolate} || !$routeit;
+ my $routeit = adjust_hops($dxchan, $s); # adjust its hop count by node name
+ $dxchan->send($routeit) unless $dxchan->{isolate} || !$routeit;
}
}
sub adjust_hops
{
my $self = shift;
+ my $s = shift;
my $call = $self->{call};
my $hops;
- if (($hops) = $_[0] =~ /\^H(\d+)\^~?$/o) {
- my ($pcno) = $_[0] =~ /^PC(\d\d)/o;
- confess "$call called adjust_hops with '$_[0]'" unless $pcno;
+ if (($hops) = $s =~ /\^H(\d+)\^~?$/o) {
+ my ($pcno) = $s =~ /^PC(\d\d)/o;
+ confess "$call called adjust_hops with '$s'" unless $pcno;
my $ref = $nodehops{$call} if %nodehops;
if ($ref) {
my $newhops = $ref->{$pcno};
- return 0 if defined $newhops && $newhops == 0;
+ return "" if defined $newhops && $newhops == 0;
$newhops = $ref->{default} unless $newhops;
- return 0 if defined $newhops && $newhops == 0;
+ return "" if defined $newhops && $newhops == 0;
$newhops = $hops if !$newhops;
- $_[0] =~ s/\^H(\d+)(\^~?)$/\^H$newhops$2/ if $newhops;
+ $s =~ s/\^H(\d+)(\^~?)$/\^H$newhops$2/ if $newhops;
} else {
# simply decrement it
$hops--;
- return 0 if !$hops;
- $_[0] =~ s/\^H(\d+)(\^~?)$/\^H$hops$2/ if $hops;
+ return "" if !$hops;
+ $s =~ s/\^H(\d+)(\^~?)$/\^H$hops$2/ if $hops;
}
}
- return 1;
+ return $s;
}
#
# $Id$
#
+require 5.004;
# search local then perl directories
BEGIN {
$conn->send_now("Z$call|bye...\n");
}
$stdout->flush if $stdout;
- kill(15, $pid) if $pid;
+ if ($pid) {
+ dbg('connect', "killing $pid");
+ kill(9, $pid);
+ }
sleep(1);
exit(0);
}
{
$SIG{CHLD} = \&sig_chld;
$waitedpid = wait;
+ dbg('connect', "caught $pid");
}
my ($host, $port) = split /\s+/, $line;
$port = 23 if !$port;
- if ($port == 23) {
- $sock = new Net::Telnet (Timeout => $timeout);
+# if ($port == 23) {
+ $sock = new Net::Telnet (Timeout => $timeout, Port => $port);
$sock->option_callback(\&optioncb);
$sock->output_record_separator('');
$sock->option_log('option_log');
$sock->dump_log('dump');
$sock->option_accept(Wont => TELOPT_ECHO);
$sock->open($host) or die "Can't connect to $host port $port $!";
- } else {
- $sock = IO::Socket::INET->new(PeerAddr => "$host:$port", Proto => 'tcp')
- or die "Can't connect to $host port $port $!";
-
- }
+# } else {
+# $sock = IO::Socket::INET->new(PeerAddr => "$host:$port", Proto => 'tcp')
+# or die "Can't connect to $host port $port $!";
+# }
} elsif ($sort eq 'ax25' || $sort eq 'prog') {
my @args = split /\s+/, $line;
$rfh = new IO::File;
sub timeout
{
dbg('connect', "timed out after $timeout seconds");
- cease(10);
+ cease(0);
}
@in = <IN>;
close IN;
- # alarm($timeout);
+ alarm($timeout);
for (@in) {
chomp;
# $Id$
#
+require 5.004;
+
# make sure that modules are searched in the order local then perl
BEGIN {
# root of directory tree for this system
return;
}
}
+ $user->{lang} = $main::lang if !$user->{lang}; # to autoupdate old systems
} else {
- if (DXCluster->get($call) || DXChannel->get($call)) {
+ if (DXCluster->get($call)) {
my $mess = DXM::msg($lang, 'conother', $call);
already_conn($conn, $call, $mess);
return;
}
- }
-
-
- # the user MAY have an SSID if local, but otherwise doesn't
- $user = DXUser->get($call);
- if (!defined $user) {
$user = DXUser->new($call);
- } else {
- $user->{lang} = $main::lang if !$user->{lang}; # to autoupdate old systems
}
-
+
# is he locked out ?
if ($user->lockout) {
Log('DXCommand', "$call is locked out, disconnected");