Explorar o código

runs message through sqWordWrap before putting it in compose area on reply

Luke Ehresman %!s(int64=25) %!d(string=hai) anos
pai
achega
e46b0d6acd
Modificáronse 2 ficheiros con 10 adicións e 1 borrados
  1. 1 0
      functions/strings.php
  2. 9 1
      src/compose.php

+ 1 - 0
functions/strings.php

@@ -51,6 +51,7 @@
    function sqWordWrap(&$line, $wrap) {
       preg_match("/^([\s>]*)([^\s>].*)$/", $line, $regs);
       $beginning_spaces = $regs[1];
+      $regs[2] .= "\n"; 
       $words = explode(" ", $regs[2]);
 
       $i = 0;

+ 9 - 1
src/compose.php

@@ -41,7 +41,7 @@
    // This function is used when not sending or adding attachments
    function newMail () {
       global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body,
-         $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc;
+         $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size;
 
       $send_to = sqStripSlashes(decodeHeader($send_to));
       $send_to_cc = sqStripSlashes(decodeHeader($send_to_cc));
@@ -72,6 +72,13 @@
          if ($message->header->type1 == "html")
             $body = strip_tags($body);
             
+         $body_ary = explode("\n", $body);
+         $body = "";
+         for ($i=0; $i < count($body_ary); $i++) {
+            sqWordWrap($body_ary[$i], $editor_size - 1);
+            $body .= $body_ary[$i];
+         }
+         $body_ary = array();
          $body_ary = explode("\n", $body);
          $body = "";
          for ($i=0; $i < count($body_ary); $i++) {
@@ -94,6 +101,7 @@
             else
                $body = "$body> $tmp\n";
          }
+
          sqimap_mailbox_close($imapConnection);
          return $body;   
       }