Change DXUser->get* to DXUser::get*
[spider.git] / perl / ExtMsg.pm
index 19380b4463d5007880395790202572a59c6e46de..0ca2de83c6f5d367a67fbb4dc87d0267372b84f0 100644 (file)
@@ -6,9 +6,11 @@
 # and out
 #
 #
-#
 # Copyright (c) 2001 - Dirk Koopman G1TLH
 #
+#      Modified Jan 2006 by John Wiseman G8BPQ to support connections to BPQ32 node,
+#              and fix pattern matching on 'chat' abort handling
+#
 
 package ExtMsg;
 
@@ -102,9 +104,9 @@ sub dequeue
                                $msg = uc $msg;
                                if (is_callsign($msg) && $msg !~ m|/| ) {
                                        my $sort = $conn->{csort};
-                                       $sort = 'local' if $conn->{peerhost} eq "127.0.0.1";
+                                       $sort = 'local' if $conn->{peerhost} =~ /127\.\d+\.\d+\.\d+$/ || $conn->{peerhost} eq '::1';
                                        my $uref;
-                                       if ($main::passwdreq || ($uref = DXUser->get_current($msg)) && $uref->passwd ) {
+                                       if ($main::passwdreq || ($uref = DXUser::get_current($msg)) && $uref->passwd ) {
                                                $conn->conns($msg);
                                                $conn->{state} = 'WP';
                                                $conn->{decho} = $conn->{echo};
@@ -118,13 +120,13 @@ sub dequeue
                                        $conn->disconnect;
                                }
                        } elsif ($conn->{state} eq 'WP' ) {
-                               my $uref = DXUser->get_current($conn->{call});
+                               my $uref = DXUser::get_current($conn->{call});
                                $msg =~ s/[\r\n]+$//;
                                if ($uref && $msg eq $uref->passwd) {
                                        my $sort = $conn->{csort};
                                        $conn->{echo} = $conn->{decho};
                                        delete $conn->{decho};
-                                       $sort = 'local' if $conn->{peerhost} eq "127.0.0.1";
+                                       $sort = 'local' if $conn->{peerhost} =~ /127\.\d+\.\d+\.\d+$/ || $conn->{peerhost} eq '::1';
                                        $conn->{usedpasswd} = 1;
                                        $conn->to_connected($conn->{call}, 'A', $sort);
                                } else {
@@ -151,7 +153,7 @@ sub to_connected
        delete $conn->{cmd};
        $conn->{timeout}->del if $conn->{timeout};
        delete $conn->{timeout};
-       $conn->nolinger;
+       $conn->nolinger unless $conn->isa('AGWMsg') || $conn->isa('BPQMsg');
        &{$conn->{rproc}}($conn, "$dir$call|$sort");
        $conn->_send_file("$main::data/connected") unless $conn->{outgoing};
 }
@@ -270,6 +272,10 @@ sub _doconnect
                # turn it into an AGW object
                bless $conn, 'AGWMsg';
                $r = $conn->connect($line);
+       } elsif ($sort eq 'bpq') {
+               # turn it into an BPQ object
+               bless $conn, 'BPQMsg';
+               $r = $conn->connect($line);
        } elsif ($sort eq 'ax25' || $sort eq 'prog') {
                $r = $conn->start_program($line, $sort);
        } else {
@@ -318,7 +324,7 @@ sub _dochat
        if ($line) {
                if ($expect) {
                        dbg("connect $conn->{cnum}: expecting: \"$expect\" received: \"$line\"") if isdbg('connect');
-                       if ($conn->{abort} && $line =~ /\Q$conn->{abort}/i) {
+                       if ($conn->{abort} && $line =~ /$conn->{abort}/i) {
                                dbg("connect $conn->{cnum}: aborted on /$conn->{abort}/") if isdbg('connect');
                                $conn->disconnect;
                                delete $conn->{cmd};