From 868deb5dabdc4d63210e4f53a2a80a904247af6a Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 06 Oct 2010 13:15:38 -0400
Subject: [PATCH] - Make htmleditor option behaviour consistent, add option to use HTML on reply to HTML message (#1485840)

---
 program/include/rcube_message.php |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/program/include/rcube_message.php b/program/include/rcube_message.php
index 19f36b3..dfccb36 100644
--- a/program/include/rcube_message.php
+++ b/program/include/rcube_message.php
@@ -214,27 +214,21 @@
     /**
      * Return the first text part of this message
      *
+     * @param rcube_message_part $part Reference to the part if found
      * @return string Plain text message/part content
      */
-    function first_text_part()
+    function first_text_part(&$part=null)
     {
         // no message structure, return complete body
         if (empty($this->parts))
             return $this->body;
-
-        $out = null;
 
         // check all message parts
         foreach ($this->mime_parts as $mime_id => $part) {
             $mimetype = $part->ctype_primary . '/' . $part->ctype_secondary;
 
             if ($mimetype == 'text/plain') {
-                $out = $this->imap->get_message_part($this->uid, $mime_id, $part);
-
-                // re-format format=flowed content
-                if ($part->ctype_secondary == 'plain' && $part->ctype_parameters['format'] == 'flowed')
-                    $out = self::unfold_flowed($out);
-                break;
+                return $this->imap->get_message_part($this->uid, $mime_id, $part);
             }
             else if ($mimetype == 'text/html') {
                 $out = $this->imap->get_message_part($this->uid, $mime_id, $part);
@@ -245,11 +239,12 @@
 
                 // create instance of html2text class
                 $txt = new html2text($out);
-                $out = $txt->get_text();
+                return $txt->get_text();
             }
         }
 
-        return $out;
+        $part = null;
+        return null;
     }
 
 

--
Gitblit v1.9.1