Made the SMTP functions now just convert \n into \r\n.
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 28 Jun 2001 15:30:28 +0000 (15:30 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 28 Jun 2001 15:30:28 +0000 (15:30 +0000)
All different types of possible newlines are converted into \n inside
compose.php.
Now checks for if the browser doesn't respect the textarea's wrap=hard
attribute and compensates.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1434 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/smtp.php
src/compose.php

index d63cea5bd3535eee50eaba82485727ff27f8cde7..b8969a11dc1a3c9ee93d289bb758e471cf5541d0 100644 (file)
       }
 
       // In order to remove the problem of users not able to create
-         // messages with "." on a blank line, RFC821 has made provision
-         // in section 4.5.2 (Transparency).
-         $body = ereg_replace("\n\\.", "\n..", $body);
-         $body = ereg_replace("^\\.", "..", $body);
+      // messages with "." on a blank line, RFC821 has made provision
+      // in section 4.5.2 (Transparency).
+      $body = ereg_replace("\n\\.", "\n..", $body);
+      $body = ereg_replace("^\\.", "..", $body);
 
       // this is to catch all plain \n instances and
-      // replace them with \r\n.  
-      $body = ereg_replace("\r\n", "\n", $body);
+      // replace them with \r\n.  All newlines were converted
+      // into just \n inside the compose.php file.
       $body = ereg_replace("\n", "\r\n", $body);
       
       if ($useSendmail) {
index 5aaca4b484d3132f10a98b0e326fe856f75369cd..0863ca9761cd46d8c143064c347044e5c9f055e1 100644 (file)
          // Set $default_charset to correspond with the user's selection
          // of language interface.
          set_my_charset();
+
+         // This is to change all newlines to \n
+        // We'll change them to \r\n later (in the sendMessage function)
+        $body = str_replace("\r\n", "\n", $body);
+        $body = str_replace("\r", "\n", $body);
+        
+        // Rewrap $body so that no line is bigger than $editor_size
+        // This should only really kick in the sqWordWrap function
+        // if the browser doesn't support "HARD" as the wrap type
+        $body = explode("\n", $body);
+        $newBody = '';
+        foreach ($body as $line) {
+           $line = trim($line);
+           if (strlen($line) <= $editor_size)
+              $newBody .= $line . "\n";
+           else {
+              sqWordWrap($line, $editor_size) . "\n";
+              $newBody .= $line;
+           }
+        }
+        $body = $newBody;
+        
+        var_dump($body);
+        
          do_hook("compose_send");
 
          if (! sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id)) {