Skip to content

Commit

Permalink
Fix resuming reply drafts in HTML mode (Bug #9928).
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Apr 19, 2011
1 parent 7077b6c commit 12ed682
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
1 change: 1 addition & 0 deletions imp/docs/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
v5.0.1-git
----------

[mms] Fix resuming reply drafts in HTML mode (Bug #9928).
[mms] Fix updating flags/logs on original messages after resuming from draft.
[mms] Fix flagging messages in search mailboxes in dynamic view.
[mms] Don't attempt to poll non-IMAP mailboxes (Bug #9896).
Expand Down
43 changes: 31 additions & 12 deletions imp/lib/Compose.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ protected function _saveDraftMsg($headers, $message, $opts)
break;
}
} catch (Horde_Exception $e) {}
} else {
$draft_headers->addHeader('X-IMP-Draft', 'Yes');
}

return $base->toString(array(
Expand Down Expand Up @@ -349,10 +351,11 @@ public function resumeDraft($indices)
if (!($reply_type = $headers->getValue('x-imp-draft-reply-type'))) {
$reply_type = self::REPLY;
}
$imp_draft = true;
$imp_draft = self::REPLY;
} elseif ($draft_url = $headers->getValue('x-imp-draft-forward')) {
$reply_type = self::FORWARD;
$imp_draft = true;
$imp_draft = $reply_type = self::FORWARD;
} elseif ($headers->getValue('x-imp-draft')) {
$imp_draft = self::COMPOSE;
}

if (IMP::getViewMode() == 'mimp') {
Expand Down Expand Up @@ -2488,7 +2491,8 @@ public function linkAttachments($part)
* @param array $options Additional options:
* <pre>
* html - (boolean) Return text/html part, if available.
* imp_msg - (boolean) If true, the message data was created by IMP.
* imp_msg - (integer) If non-empty, the message data was created by IMP.
* Either self::COMPOSE, self::FORWARD, or self::REPLY.
* replylimit - (boolean) Enforce length limits?
* toflowed - (boolean) Do flowed conversion?
* </pre>
Expand All @@ -2502,21 +2506,36 @@ public function linkAttachments($part)
* 'text' - (string) The body text.
* </pre>
*/
protected function _getMessageText($contents, $options = array())
protected function _getMessageText($contents, array $options = array())
{
$body_id = null;
$mode = 'text';
$options = array_merge(array(
'imp_msg' => self::COMPOSE
), $options);

if (!empty($options['html']) &&
$GLOBALS['session']->get('imp', 'rteavail')) {
$body_id = $contents->findBody('html');
if (!is_null($body_id) &&
(empty($options['imp_msg']) ||
(strval($body_id) == '1') ||
Horde_Mime::isChild('1', $body_id))) {
$mode = 'html';
} else {
$body_id = null;
if (!is_null($body_id)) {
switch ($options['imp_msg']) {
case self::REPLY:
$check_id = '2';
break;

case self::COMPOSE:
case self::FORWARD:
default:
$check_id = '1';
break;
}

if ((strval($body_id) == $check_id) ||
Horde_Mime::isChild($check_id, $body_id)) {
$mode = 'html';
} else {
$body_id = null;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions imp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
</stability>
<license uri="http://www.gnu.org/licenses/gpl.html">GPL</license>
<notes>
* [mms] Fix resuming reply drafts in HTML mode (Bug #9928).
* [mms] Fix updating flags/logs on original messages after resuming from draft.
* [mms] Fix flagging messages in search mailboxes in dynamic view.
* [mms] Don&apos;t attempt to poll non-IMAP mailboxes (Bug #9896).
Expand Down

0 comments on commit 12ed682

Please sign in to comment.