From 407d9a80a8af1fa6c1ae2c8fbca833e49da6e816 Mon Sep 17 00:00:00 2001 From: minima Date: Tue, 9 Oct 2001 21:41:23 +0000 Subject: [PATCH] put in a prototype echo handler in Msg/ExtMsg --- Changes | 2 ++ perl/DXCommandmode.pm | 4 +++- perl/DXMsg.pm | 1 - perl/DXProt.pm | 1 + perl/ExtMsg.pm | 7 +++++++ perl/Msg.pm | 20 +++++++++++++++++++- 6 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index 11308893..f32123d1 100644 --- 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. +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 diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 43dab053..97ac4862 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -123,9 +123,11 @@ sub start } # decide on echo - if (!$user->wantecho) { + my $echo = $user->wantecho; + unless ($echo) { $self->send_now('E', "0"); $self->send($self->msg('echow')); + $self->conn->echo($echo) if $self->conn->can('echo'); } $self->tell_login('loginu'); diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index 0cc0c0d4..77259d07 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -1218,7 +1218,6 @@ sub import_msgs 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 diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 71cef0e2..cb49f798 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -256,6 +256,7 @@ sub start # 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; diff --git a/perl/ExtMsg.pm b/perl/ExtMsg.pm index 75b025f3..78daffe2 100644 --- a/perl/ExtMsg.pm +++ b/perl/ExtMsg.pm @@ -60,6 +60,12 @@ sub send_raw Msg::set_event_handler ($sock, "write" => sub {$conn->_send(0)}); } +sub echo +{ + my $conn = shift; + $conn->{echo} = 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->{echo} = 1; } else { &{$conn->{eproc}}() if $conn->{eproc}; $conn->disconnect(); diff --git a/perl/Msg.pm b/perl/Msg.pm index 3f52e39d..615feb19 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -386,11 +386,29 @@ sub _rcv { # Complement to _send $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 ($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($!)) { -- 2.43.0