put in a prototype echo handler in Msg/ExtMsg
authorminima <minima>
Tue, 9 Oct 2001 21:41:23 +0000 (21:41 +0000)
committerminima <minima>
Tue, 9 Oct 2001 21:41:23 +0000 (21:41 +0000)
Changes
perl/DXCommandmode.pm
perl/DXMsg.pm
perl/DXProt.pm
perl/ExtMsg.pm
perl/Msg.pm

diff --git a/Changes b/Changes
index 11308893065fcc7d54fefe873e62c01ea082c79c..f32123d106aef7cf455e1d6d549ac1f7564f41f1 100644 (file)
--- a/Changes
+++ b/Changes
@@ -14,6 +14,8 @@ sort of filth as much as possible whilst not inconveniencing 'normal' users.
 deletion two days hence. To have the old behaviour, do a 'kill exp' or use
 the standard alias "expunge". This will cause the message to be deleted at
 the next queue message cycle.
 deletion two days hence. To have the old behaviour, do a 'kill exp' or use
 the standard alias "expunge". This will cause the message to be deleted at
 the next queue message cycle.
+5. Put in prototype echo handling for direct connections using ExtMsg and
+Listeners.pm.
 04Oct01=======================================================================
 1. allow a residence time of (default) 2 days before actually deleting a msg.
 2. reduce the number R: lines on a bull from a bbs to 2 (the origin and the
 04Oct01=======================================================================
 1. allow a residence time of (default) 2 days before actually deleting a msg.
 2. reduce the number R: lines on a bull from a bbs to 2 (the origin and the
index 43dab0535fd0a1430442be5c6f75b3e03ebccacb..97ac48623e192cd47b78488996edeb2823a9d3c3 100644 (file)
@@ -123,9 +123,11 @@ sub start
        }
 
        # decide on echo
        }
 
        # decide on echo
-       if (!$user->wantecho) {
+       my $echo = $user->wantecho;
+       unless ($echo) {
                $self->send_now('E', "0");
                $self->send($self->msg('echow'));
                $self->send_now('E', "0");
                $self->send($self->msg('echow'));
+               $self->conn->echo($echo) if $self->conn->can('echo');
        }
        
        $self->tell_login('loginu');
        }
        
        $self->tell_login('loginu');
index 0cc0c0d4d853d4458abd07366ed4aeb74fc572a7..77259d071ad2e18707ed5f32e79cbf669b675a35 100644 (file)
@@ -1218,7 +1218,6 @@ sub import_msgs
                my @out = import_one($main::me, \@msg, $splitit);
                Log('msg', @out);
        }
                my @out = import_one($main::me, \@msg, $splitit);
                Log('msg', @out);
        }
-       queue_msg(0);
 }
 
 # import one message as a list in bbs (as extended) mode
 }
 
 # import one message as a list in bbs (as extended) mode
index 71cef0e220d81071f5ddf931973020cb301a1b49..cb49f7980b39d2daadc002f044fba35619917e2a 100644 (file)
@@ -256,6 +256,7 @@ sub start
        # set unbuffered and no echo
        $self->send_now('B',"0");
        $self->send_now('E',"0");
        # set unbuffered and no echo
        $self->send_now('B',"0");
        $self->send_now('E',"0");
+       $self->conn->echo(0) if $self->conn->can('echo');
        
        # ping neighbour node stuff
        my $ping = $user->pingint;
        
        # ping neighbour node stuff
        my $ping = $user->pingint;
index 75b025f397cf34f553799460ed57318584c01490..78daffe263483b32d53a405c154ee696adadac47 100644 (file)
@@ -60,6 +60,12 @@ sub send_raw
     Msg::set_event_handler ($sock, "write" => sub {$conn->_send(0)});
 }
 
     Msg::set_event_handler ($sock, "write" => sub {$conn->_send(0)});
 }
 
+sub echo
+{
+       my $conn = shift;
+       $conn->{echo} = shift;
+}
+
 sub dequeue
 {
        my $conn = shift;
 sub dequeue
 {
        my $conn = shift;
@@ -160,6 +166,7 @@ sub new_client {
                                $conn->_send_file("$main::data/issue");
                                $conn->send_raw("login: ");
                                $conn->_dotimeout(60);
                                $conn->_send_file("$main::data/issue");
                                $conn->send_raw("login: ");
                                $conn->_dotimeout(60);
+                               $conn->{echo} = 1;
                        } else { 
                                &{$conn->{eproc}}() if $conn->{eproc};
                                $conn->disconnect();
                        } else { 
                                &{$conn->{eproc}}() if $conn->{eproc};
                                $conn->disconnect();
index 3f52e39dfe8057d4fb202f364be81eb36567ceb3..615feb1987e4a102def727f208d093107f63d85b 100644 (file)
@@ -386,11 +386,29 @@ sub _rcv {                     # Complement to _send
        $bytes_read = sysread ($sock, $msg, 1024, 0);
        if (defined ($bytes_read)) {
                if ($bytes_read > 0) {
        $bytes_read = sysread ($sock, $msg, 1024, 0);
        if (defined ($bytes_read)) {
                if ($bytes_read > 0) {
-                       $conn->{msg} .= $msg;
                        if (isdbg('raw')) {
                                my $call = $conn->{call} || 'none';
                                dbgdump('raw', "$call read $bytes_read: ", $msg);
                        }
                        if (isdbg('raw')) {
                                my $call = $conn->{call} || 'none';
                                dbgdump('raw', "$call read $bytes_read: ", $msg);
                        }
+                       if ($conn->{echo}) {
+                               my @ch = split //, $msg;
+                               my $out;
+                               for (@ch) {
+                                       if (/[\cH\x7f]/) {
+                                               $out .= "\cH \cH";
+                                               $conn->{msg} =~ s/.$//;
+                                       } else {
+                                               $out .= $_;
+                                               $conn->{msg} .= $_;
+                                       }
+                               }
+                               if (defined $out) {
+                                       set_event_handler ($sock, write => sub{$conn->_send(0)});
+                                       push @{$conn->{outqueue}}, $out;
+                               }
+                       } else {
+                               $conn->{msg} .= $msg;
+                       }
                } 
        } else {
                if (_err_will_block($!)) {
                } 
        } else {
                if (_err_will_block($!)) {