From: kink Date: Thu, 19 Aug 2004 08:13:39 +0000 (+0000) Subject: Fix outgoing body wrapping in devel, by forwardporting the working code X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=18c9998a873a4f1ebcb8dedb0612cf77c8e288d8;p=squirrelmail.git Fix outgoing body wrapping in devel, by forwardporting the working code from stable. We were sending out mails unwrapped, so they had really long lines. The statement in the comment that many browsers support VIRTUAL is wrong (has that statement been tested?) because I just tested it in Firefox and IE6; in both browsers mail bodies were not wrapped at all. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7944 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/src/compose.php b/src/compose.php index 5057a585..6d4c7238 100644 --- a/src/compose.php +++ b/src/compose.php @@ -369,12 +369,24 @@ if ($send) { $body = str_replace("\r", "\n", $body); /** - * If the browser doesn't support "VIRTUAL" as the wrap type. - * then the line length will be longer than $editor_size - * almost all browsers support VIRTUAL, so remove the line by line checking - * If this causes a problem, call sqBodyWrap + * Rewrap $body so that no line is bigger than $editor_size */ - // sqBodyWrap($body, $editor_size); + $body = explode("\n", $body); + $newBody = ''; + foreach ($body as $line) { + if( $line <> '-- ' ) { + $line = rtrim($line); + } + if (strlen($line) <= $editor_size + 1) { + $newBody .= $line . "\n"; + } else { + sqWordWrap($line, $editor_size); + $newBody .= $line . "\n"; + + } + + } + $body = $newBody; $composeMessage=$compose_messages[$session]; @@ -1547,4 +1559,4 @@ function deliverMessage($composeMessage, $draft=false) { } // vim: et ts=4 -?> \ No newline at end of file +?>