Browse Source

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.

Thijs Kinkhorst 21 năm trước cách đây
mục cha
commit
5e0436355f
1 tập tin đã thay đổi với 18 bổ sung6 xóa
  1. 18 6
      src/compose.php

+ 18 - 6
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
-?>
+?>