made sorting a bit faster
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 16 Nov 2000 14:16:53 +0000 (14:16 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 16 Nov 2000 14:16:53 +0000 (14:16 +0000)
replaced \n with \r\n in body of message before sending

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

ChangeLog
functions/mailbox_display.php
functions/smtp.php
src/read_body.php

index d300d2760175f6450a2b881c7475fd44ed2f7d07..0473e70bcc970469e8578268b9cfe79263c7aea3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 Version 1.0pre1 -- DEVELOPMENT
 ------------------------------
 Version 1.0pre1 -- DEVELOPMENT
 ------------------------------
+- Now replacing all \n with \r\n before sending the message.
 - Added sorting option for NO sorting.. 10000 times faster!
 - Using <pre> tags for viewing message body instead of <tt> and &nbsp;
 - Added redirection from subdirectories to login page
 - Added sorting option for NO sorting.. 10000 times faster!
 - Using <pre> tags for viewing message body instead of <tt> and &nbsp;
 - Added redirection from subdirectories to login page
index 4fe113dc93d5d65a59cc38a9e5f5bb74f9670b2f..ef25fba593f654f34ecbdcde17eb797aa39d07bd 100644 (file)
@@ -63,7 +63,7 @@
                echo "   <td nowrap width=1% bgcolor=$hlt_color><center>$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end</center></td>\n";
                break;
             case 4: # subject
                echo "   <td nowrap width=1% bgcolor=$hlt_color><center>$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end</center></td>\n";
                break;
             case 4: # subject
-               echo "   <td bgcolor=$hlt_color>$bold<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$startMessage&show_more=0$search_stuff\">$flag$subject$flag_end</a>$bold_end</td>\n";
+               echo "   <td bgcolor=$hlt_color>$bold<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$true_startMessage&show_more=0$search_stuff\">$flag$subject$flag_end</a>$bold_end</td>\n";
                break;
             case 5: # flags
                $stuff = false;
                break;
             case 5: # flags
                $stuff = false;
                if ($msg["FLAG_ANSWERED"] == true) {
                   echo "A\n";
                   $stuff = true;
                if ($msg["FLAG_ANSWERED"] == true) {
                   echo "A\n";
                   $stuff = true;
-               } 
+               }
                if ($msg["TYPE0"] == "multipart") {
                   echo "+\n";
                   $stuff = true;
                if ($msg["TYPE0"] == "multipart") {
                   echo "+\n";
                   $stuff = true;
-               } 
+               }
                if (ereg("(1|2)",substr($msg["PRIORITY"],0,1))) {
                   echo "<font color=$color[1]>!</font>\n";
                   $stuff = true;
                if (ereg("(1|2)",substr($msg["PRIORITY"],0,1))) {
                   echo "<font color=$color[1]>!</font>\n";
                   $stuff = true;
                   echo "<font color=\"$color[1]\">D</font>\n";
                   $stuff = true;
                }
                   echo "<font color=\"$color[1]\">D</font>\n";
                   $stuff = true;
                }
-               
+
                if (!$stuff) echo "&nbsp;\n";
                echo "</small></b></td>\n";
                break;
                if (!$stuff) echo "&nbsp;\n";
                echo "</small></b></td>\n";
                break;
-            case 6: # size   
+            case 6: # size
                echo "   <td bgcolor=$hlt_color width=1%>$bold".show_readable_size($msg['SIZE'])."$bold_end</td>\n";
                break;
          }
                echo "   <td bgcolor=$hlt_color width=1%>$bold".show_readable_size($msg['SIZE'])."$bold_end</td>\n";
                break;
          }
          "move_messages.php?msg=$msg&mailbox=$urlMailbox&startMessage=$startMessage",
           $mailbox, $sort, $Message, $More);
 
          "move_messages.php?msg=$msg&mailbox=$urlMailbox&startMessage=$startMessage",
           $mailbox, $sort, $Message, $More);
 
-      // $groupNum = $startMessage % ($show_num - 1);
+      $groupNum = $startMessage % ($show_num - 1);
       if ($sort == 6) {
          if ($endMessage - $startMessage < $show_num - 1) {
             $endMessage = $endMessage - $startMessage + 1;
       if ($sort == 6) {
          if ($endMessage - $startMessage < $show_num - 1) {
             $endMessage = $endMessage - $startMessage + 1;
     * $Message is a message that is centered on top of the list
     * $More is a second line that is left aligned
     */
     * $Message is a message that is centered on top of the list
     * $More is a second line that is left aligned
     */
-   function mail_message_listing_beginning($imapConnection, $moveURL, 
+   function mail_message_listing_beginning($imapConnection, $moveURL,
        $mailbox = '', $sort = -1, $Message = '', $More = '')
    {
       global $color, $index_order, $auto_expunge, $move_to_trash;
        $mailbox = '', $sort = -1, $Message = '', $More = '')
    {
       global $color, $index_order, $auto_expunge, $move_to_trash;
-       
+
          /** This is the beginning of the message list table.  It wraps around all messages */
       echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0>";
          /** This is the beginning of the message list table.  It wraps around all messages */
       echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0>";
-      
+
       if ($Message)
       {
          echo "<TR BGCOLOR=\"$color[4]\"><TD align=center>$Message</td></tr>\n";
       }
       if ($Message)
       {
          echo "<TR BGCOLOR=\"$color[4]\"><TD align=center>$Message</td></tr>\n";
       }
-      
+
       if ($More)
       {
          echo "<TR BGCOLOR=\"$color[4]\"><TD>$More</td></tr>\n";
       if ($More)
       {
          echo "<TR BGCOLOR=\"$color[4]\"><TD>$More</td></tr>\n";
 
       $boxes = sqimap_mailbox_list($imapConnection);
       for ($i = 0; $i < count($boxes); $i++) {
 
       $boxes = sqimap_mailbox_list($imapConnection);
       for ($i = 0; $i < count($boxes); $i++) {
-         if ($boxes[$i]["flags"][0] != "noselect" && 
-            $boxes[$i]["flags"][1] != "noselect" && 
+         if ($boxes[$i]["flags"][0] != "noselect" &&
+            $boxes[$i]["flags"][1] != "noselect" &&
             $boxes[$i]["flags"][2] != "noselect") {
             $box = $boxes[$i]["unformatted"];
             $box2 = replace_spaces($boxes[$i]["formatted"]);
             $boxes[$i]["flags"][2] != "noselect") {
             $box = $boxes[$i]["unformatted"];
             $box2 = replace_spaces($boxes[$i]["formatted"]);
       echo "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
 
       $urlMailbox=urlencode($mailbox);
       echo "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
 
       $urlMailbox=urlencode($mailbox);
-      
+
       // Print the headers
       for ($i=1; $i <= count($index_order); $i++) {
          switch ($index_order[$i]) {
       // Print the headers
       for ($i=1; $i <= count($index_order); $i++) {
          switch ($index_order[$i]) {
                   echo "   <A HREF=\"right_main.php?newsort=1&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
                elseif ($sort == 1)
                   echo "   <A HREF=\"right_main.php?newsort=6&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/down_pointer.gif\" BORDER=0></A></TD>\n";
                   echo "   <A HREF=\"right_main.php?newsort=1&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
                elseif ($sort == 1)
                   echo "   <A HREF=\"right_main.php?newsort=6&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/down_pointer.gif\" BORDER=0></A></TD>\n";
-               elseif ($sort == 6)   
+               elseif ($sort == 6)
                   echo "   <A HREF=\"right_main.php?newsort=0&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
                elseif ($sort != -1)
                   echo "   <A HREF=\"right_main.php?newsort=0&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
                   echo "   <A HREF=\"right_main.php?newsort=0&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
                elseif ($sort != -1)
                   echo "   <A HREF=\"right_main.php?newsort=0&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
index ad7a257ae29ddaf697a8c1ae68cd4f37eeb0621f..9546fe76bd7619242abe73b12699524d0f804fe0 100644 (file)
          $to_list = getLineOfAddrs($to);
          $cc_list = getLineOfAddrs($cc);
          $bcc_list = getLineOfAddrs($bcc);
          $to_list = getLineOfAddrs($to);
          $cc_list = getLineOfAddrs($cc);
          $bcc_list = getLineOfAddrs($bcc);
-         
+
          /* Encoding 8-bit characters and making from line */
          $subject = sqStripSlashes(encodeHeader($subject));
          if ($from == "")
          /* Encoding 8-bit characters and making from line */
          $subject = sqStripSlashes(encodeHeader($subject));
          if ($from == "")
          }
          sqimap_mailbox_close($imap_stream);
       }
          }
          sqimap_mailbox_close($imap_stream);
       }
-      
-      if ($useSendmail) {  
+
+      // this is to catch all plain \n instances and
+      // replace them with \r\n.  
+      $body = ereg_replace("\r\n", "\n", $body);
+      $body = ereg_replace("\n", "\r\n", $body);
+
+      if ($useSendmail) {
          $length = sendSendmail($t, $c, $b, $subject, $body, $more_headers);
       } else {
          $length = sendSMTP($t, $c, $b, $subject, $body, $more_headers);
          $length = sendSendmail($t, $c, $b, $subject, $body, $more_headers);
       } else {
          $length = sendSMTP($t, $c, $b, $subject, $body, $more_headers);
       if (sqimap_mailbox_exists ($imap_stream, $sent_folder)) {
          sqimap_append ($imap_stream, $sent_folder, $length);
          write822Header ($imap_stream, $t, $c, $b, $subject, $more_headers);
       if (sqimap_mailbox_exists ($imap_stream, $sent_folder)) {
          sqimap_append ($imap_stream, $sent_folder, $length);
          write822Header ($imap_stream, $t, $c, $b, $subject, $more_headers);
-         writeBody ($imap_stream, $body); 
+         writeBody ($imap_stream, $body);
          sqimap_append_done ($imap_stream);
          sqimap_append_done ($imap_stream);
-      }   
-      sqimap_logout($imap_stream); 
+      }
+      sqimap_logout($imap_stream);
       // Delete the files uploaded for attaching (if any).
       deleteAttachments();
    }
       // Delete the files uploaded for attaching (if any).
       deleteAttachments();
    }
-   
+
 ?>
 ?>
index 3aa9bdb43385b94a9506b270986776e299f3d32b..e3079f176b7b7b77cee3b122e2cd34e05dcf57f5 100644 (file)
@@ -40,7 +40,7 @@
       if ($where && $what) {
          // Got here from a search
          echo "<a href=\"read_body.php?mailbox=".urlencode($mailbox)."&passed_id=$passed_id&where=".urlencode($where)."&what=".urlencode($what)."\">";
       if ($where && $what) {
          // Got here from a search
          echo "<a href=\"read_body.php?mailbox=".urlencode($mailbox)."&passed_id=$passed_id&where=".urlencode($where)."&what=".urlencode($what)."\">";
-      } else {  
+      } else {
          echo "<a href=\"read_body.php?mailbox=".urlencode($mailbox)."&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more\">";
       }
       echo ""._("View message") . "</a></b></center></td></tr></table>\n";
          echo "<a href=\"read_body.php?mailbox=".urlencode($mailbox)."&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more\">";
       }
       echo ""._("View message") . "</a></b></center></td></tr></table>\n";
@@ -96,7 +96,7 @@
    }
 
    if (isset($msgs)) {
    }
 
    if (isset($msgs)) {
-               $currentArrayIndex = $passed_id;
+          $currentArrayIndex = $passed_id;
                /*
       for ($i=0; $i < count($msgs); $i++) {
          if ($msgs[$i]["ID"] == $passed_id) {
                /*
       for ($i=0; $i < count($msgs); $i++) {
          if ($msgs[$i]["ID"] == $passed_id) {
 
    do_hook("read_body_top");
    echo "<BR>";
 
    do_hook("read_body_top");
    echo "<BR>";
+
+
+   echo "START: $startMessage<br>";
+
+
    echo "<TABLE COLS=1 CELLSPACING=0 WIDTH=100% BORDER=0 ALIGN=CENTER CELLPADDING=0>\n";
    echo "   <TR><TD BGCOLOR=\"$color[9]\" WIDTH=100%>";
    echo "      <TABLE WIDTH=100% CELLSPACING=0 BORDER=0 COLS=2 CELLPADDING=3>";
    echo "<TABLE COLS=1 CELLSPACING=0 WIDTH=100% BORDER=0 ALIGN=CENTER CELLPADDING=0>\n";
    echo "   <TR><TD BGCOLOR=\"$color[9]\" WIDTH=100%>";
    echo "      <TABLE WIDTH=100% CELLSPACING=0 BORDER=0 COLS=2 CELLPADDING=3>";