From: Michael M Slusarz Date: Wed, 11 Feb 2009 06:46:31 +0000 (-0700) Subject: Remove leading/trailing whitespace in reply text X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=7cdef9a716db6a0a079481092dce749e3aef5137;p=horde.git Remove leading/trailing whitespace in reply text --- diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index 309cb93b2..904ec883a 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -2,6 +2,7 @@ v5.0-git -------- +[mms] Trim leading/trailing whitespace from reply text. [mms] Add full IMAP message flagging capabilities to DIMP. [mms] Decode IDN (RFC 3490) names in addresses (Request #5836). [mms] Add ability to download attachments in MIMP (Request #2925). diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index 4658da5c4..cbf94e60a 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -282,7 +282,7 @@ class IMP_Compose return $contents; } - $msg_text = $this->_getMessageText($contents); + $msg_text = $this->_getMessageText($contents, array('type' => 'draft')); if (empty($msg_text)) { $message = ''; $mode = 'text'; @@ -1292,7 +1292,8 @@ class IMP_Compose $msg_text = $this->_getMessageText($contents, array( 'html' => ($GLOBALS['prefs']->getValue('reply_format') || $compose_html), 'replylimit' => true, - 'toflowed' => true + 'toflowed' => true, + 'type' => 'reply' )); if (!empty($msg_text) && @@ -1374,7 +1375,8 @@ class IMP_Compose $compose_html = $GLOBALS['prefs']->getValue('compose_html'); $msg_text = $this->_getMessageText($contents, array( - 'html' => ($GLOBALS['prefs']->getValue('reply_format') || $compose_html) + 'html' => ($GLOBALS['prefs']->getValue('reply_format') || $compose_html), + 'type' => 'forward' )); if (!empty($msg_text) && @@ -2147,6 +2149,7 @@ class IMP_Compose * 'html' - (boolean) Return text/html part, if available. * 'replylimit' - (boolean) Enforce length limits? * 'toflowed' - (boolean) Convert to flowed? + * 'type' - (string) 'draft', 'forward', or 'reply'. * * * @return mixed Null if bodypart not found, or array with the following @@ -2154,8 +2157,8 @@ class IMP_Compose *
      * 'encoding' - (string) The guessed encoding to use.
      * 'id' - (string) The MIME ID of the bodypart.
-     * 'mode' - (string)
-     * 'text' - (string)
+     * 'mode' - (string) Either 'text' or 'html'.
+     * 'text' - (string) The body text.
      * 
*/ protected function _getMessageText($contents, $options = array()) @@ -2211,6 +2214,12 @@ class IMP_Compose } if ($type == 'text/plain') { + /* For replies, remove all leading/trailing whitespace. This + * doesn't add anything to reply data. */ + if ($options['type'] == 'reply') { + $msg = trim($msg); + } + if ($part->getContentTypeParameter('format') == 'flowed') { require_once 'Text/Flowed.php'; $flowed = new Text_Flowed($msg);