From 0532498703496837c2932ffd794c656bdc350d77 Mon Sep 17 00:00:00 2001 From: "ian%hixie.ch" Date: Wed, 13 Feb 2002 02:20:01 +0000 Subject: [PATCH] Fixing regression introduced by the CTCP patch: long lines no longer get wrapped. Also includes minor cleanup. r=kerz --- webtools/mozbot/mozbot.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webtools/mozbot/mozbot.pl b/webtools/mozbot/mozbot.pl index 11c4b49103cd..97607e665cab 100755 --- a/webtools/mozbot/mozbot.pl +++ b/webtools/mozbot/mozbot.pl @@ -128,7 +128,7 @@ $|++; # internal 'constants' my $NAME = 'mozbot'; -my $VERSION = q$Revision: 2.6 $; +my $VERSION = q$Revision: 2.7 $; my $USERNAME = "pid-$$"; my $LOGFILEPREFIX; @@ -813,7 +813,7 @@ sub sendmsg { cluck('Wrong arguments passed to sendmsg() - ignored'); } else { $self->schedule($delaytime / 2, \&drainmsgqueue) unless @msgqueue; - if ($msg eq 'msg' or $msg eq 'me') { + if ($do eq 'msg' or $do eq 'me') { foreach (splitMessageAcrossLines($msg)) { push(@msgqueue, [$who, $_, $do]); } @@ -871,7 +871,7 @@ sub splitMessageAcrossLines { foreach my $line (split(/\n/, $str)) { while (length($line) > $MAXPROTOCOLLENGTH) { # position is zero-based index - my $pos = rindex($line, " ", $MAXPROTOCOLLENGTH - 1); + my $pos = rindex($line, ' ', $MAXPROTOCOLLENGTH - 1); if ($pos < 0) { $pos = $MAXPROTOCOLLENGTH - 1; } @@ -879,7 +879,7 @@ sub splitMessageAcrossLines { $line = substr($line, $pos); $line =~ s/^\s+//gos; } - push(@output, $line) if $line; + push(@output, $line) if length($line); } return @output; }