From b672afe940f843351af2bc4a87b4c4239f3a5140 Mon Sep 17 00:00:00 2001 From: minima Date: Tue, 6 Nov 2001 23:56:18 +0000 Subject: [PATCH] 2. fix console.pl to show blank lines more reliably. 3. fix msgs so that 2 R: lines are only stored on initial entry (not just after forwarding). --- Changes | 3 +++ perl/DXCommandmode.pm | 2 +- perl/DXMsg.pm | 18 ++++++++++++++++- perl/console.pl | 46 +++++++++++++++++++++---------------------- 4 files changed, 44 insertions(+), 25 deletions(-) diff --git a/Changes b/Changes index 7201d694..7988e3d8 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,9 @@ 06Nov01======================================================================= 1. fix read so that sysop reading doesn't increment the read counter for private mail not addressed to them. +2. fix console.pl to show blank lines more reliably. +3. fix msgs so that 2 R: lines are only stored on initial entry (not just +after forwarding). 04Nov01======================================================================= 1. Allow the user to equal the node in RSPF checks (this allows spots and stuff with the origin and spotter to be the same (although it is STRONGLY diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 6efd8cee..58b42969 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -89,7 +89,7 @@ sub start $self->{priv} = $user->priv || 0; $self->{lang} = $user->lang || $main::lang || 'en'; $self->{pagelth} = $user->pagelth || 20; - ($self->{width}) = $line =~ /width=(\d+)/; + ($self->{width}) = $line =~ /width=(\d+)/; $line =~ s/\s*width=\d+\s*//; $self->{width} = 80 unless $self->{width} && $self->{width} > 80; $self->{consort} = $line; # save the connection type diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index dbcd8097..cd3bf74b 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -1091,9 +1091,25 @@ sub do_send_stuff Log('msg', "line: $line"); $loc->{reject}++; } + + if (@{$loc->{lines}}) { + push @{$loc->{lines}}, length($line) > 0 ? $line : " "; + } else { + # temporarily store any R: lines so that we end up with + # only the first and last ones stored. + if ($line =~ m|^R:\d{6}/\d{4}|) { + push @{$loc->{tempr}}, $line; + } else { + if (exists $loc->{tempr}) { + push @{$loc->{lines}}, shift @{$loc->{tempr}}; + push @{$loc->{lines}}, pop @{$loc->{tempr}} if @{$loc->{tempr}}; + delete $loc->{tempr}; + } + push @{$loc->{lines}}, length($line) > 0 ? $line : " "; + } + } # i.e. it ain't and end or abort, therefore store the line - push @{$loc->{lines}}, length($line) > 0 ? $line : " "; } } return @out; diff --git a/perl/console.pl b/perl/console.pl index 4dba480b..fd033d90 100755 --- a/perl/console.pl +++ b/perl/console.pl @@ -191,7 +191,7 @@ sub show_screen my $lines = measure($line); last if $i + $lines > $pagel; setattr($line); - $top->addstr($i, 0, $line); + $top->addstr($i, 0, "$line\n"); $top->attrset(COLOR_PAIR(0)) if $has_colors; $i += $lines; } @@ -236,6 +236,7 @@ sub rec_socket my ($sort, $call, $line) = $msg =~ /^(\w)([^\|]+)\|(.*)$/; if ($sort && $sort eq 'D') { + $line = " " unless $line; addtotop($line); } elsif ($sort && $sort eq 'Z') { # end, disconnect, go, away ..... cease(0); @@ -267,39 +268,38 @@ sub rec_stdin if ($r eq KEY_ENTER || $r eq "\n" || $r eq "\r") { # save the lines - if ($inbuf) { - # check for a pling and do a search back for a command - if ($inbuf =~ /^!/o) { - my $i; - $inbuf =~ s/^!//o; - for ($i = $#khistory; $i >= 0; $i--) { - if ($khistory[$i] =~ /^$inbuf/) { - $inbuf = $khistory[$i]; - last; - } - } - if ($i < 0) { - beep(); - return; + $inbuf = " " unless $inbuf; + + # check for a pling and do a search back for a command + if ($inbuf =~ /^!/o) { + my $i; + $inbuf =~ s/^!//o; + for ($i = $#khistory; $i >= 0; $i--) { + if ($khistory[$i] =~ /^$inbuf/) { + $inbuf = $khistory[$i]; + last; } } - push @khistory, $inbuf if $inbuf; - shift @khistory if @khistory > $maxkhist; - $khistpos = @khistory; - $bot->move(0,0); - $bot->clrtoeol(); - $bot->addstr(substr($inbuf, 0, $cols)); + if ($i < 0) { + beep(); + return; + } } + push @khistory, $inbuf if $inbuf; + shift @khistory if @khistory > $maxkhist; + $khistpos = @khistory; + $bot->move(0,0); + $bot->clrtoeol(); + $bot->addstr(substr($inbuf, 0, $cols)); # add it to the monitor window unless ($spos == @shistory) { $spos = @shistory; show_screen(); }; - addtotop($inbuf) if $inbuf; + addtotop($inbuf); # send it to the cluster - $inbuf = " " unless $inbuf; $conn->send_later("I$call|$inbuf"); $inbuf = ""; $pos = $lth = 0; -- 2.43.0