X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fclient.pl;h=91d4add615bf049cc2fbaa3380c0c99437878a83;hb=f7ce6f45eae627c1368ffea0e1e56e84fec676be;hp=84ab5d530ee7e770636299302306469c2ad3dc18;hpb=ce93c2b985c3ac38b4909025de62c264423fce21;p=spider.git diff --git a/perl/client.pl b/perl/client.pl index 84ab5d53..91d4add6 100755 --- a/perl/client.pl +++ b/perl/client.pl @@ -46,14 +46,13 @@ use Net::Telnet qw(TELOPT_ECHO); use IO::File; use IO::Socket; use IPC::Open2; -use Carp qw{cluck}; # cease communications sub cease { my $sendz = shift; if ($conn && $sendz) { - $conn->send_now("Z$call|bye...\n"); + $conn->send_now("Z$call|bye..."); sleep(1); } $stdout->flush if $stdout; @@ -148,7 +147,13 @@ sub rec_socket $buffered = $line; # set buffered or unbuffered } elsif ($sort eq 'Z') { # end, disconnect, go, away ..... cease(0); - } + } + + # ****************************************************** + # ****************************************************** + # any other sorts that might happen are silently ignored. + # ****************************************************** + # ****************************************************** } $lasttime = time; } @@ -304,6 +309,14 @@ sub timeout cease(0); } +# handle callsign and connection type firtling +sub doclient +{ + my $line = shift; + my @f = split /\s+/, $line; + $call = uc $f[0] if $f[0]; + $csort = $f[1] if $f[1]; +} # # initialisation @@ -358,7 +371,7 @@ $stdout->autoflush(1); $SIG{'INT'} = \&sig_term; $SIG{'TERM'} = \&sig_term; -$SIG{'HUP'} = 'IGNORE'; +$SIG{'HUP'} = \&sig_term; $SIG{'CHLD'} = \&sig_chld; $SIG{'ALRM'} = \&timeout; @@ -403,15 +416,6 @@ if ($loginreq) { alarm(0); } -# handle callsign and connection type firtling -sub doclient -{ - my $line = shift; - my @f = split /\s+/, $line; - $call = uc $f[0] if $f[0]; - $csort = $f[1] if $f[1]; -} - # is this an out going connection? if ($connsort eq "connect") { my $mcall = lc $call; @@ -429,8 +433,8 @@ if ($connsort eq "connect") { doconnect($1, $2) if /^\s*co\w*\s+(\w+)\s+(.*)$/io; doabort($1) if /^\s*a\w*\s+(.*)/io; dotimeout($1) if /^\s*t\w*\s+(\d+)/io; - dochat($1, $2) if /\s*\'(.*)\'\s+\'(.*)\'/io; - if (/\s*cl\w+\s+(.*)/io) { + dochat($1, $2) if /^\s*\'(.*)\'\s+\'(.*)\'/io; + if (/^\s*cl\w+\s+(.*)/io) { doclient($1); last; } @@ -467,6 +471,20 @@ if ($connsort eq "connect") { $mode = ($connsort eq 'ax25') ? 1 : 2; setmode(); +# adjust the callsign if it has an SSID, SSID <= 8 are legal > 8 are netrom connections +my ($scall, $ssid) = split /-/, $call; +$ssid = undef unless $ssid && $ssid =~ /^\d+$/; +if ($ssid) { + $ssid = 15 if $ssid > 15; + if ($connsort eq 'ax25') { + if ($ssid > 8) { + $ssid = 15 - $ssid; + } + } + $call = "$scall-$ssid"; +} + + $conn = Msg->connect("$clusteraddr", $clusterport, \&rec_socket); if (! $conn) { if (-r "$data/offline") {