From: Michael M Slusarz Date: Mon, 8 Dec 2008 06:44:51 +0000 (-0700) Subject: Fix for Ticket #4221. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6a745eaa96a8f63c528d1b9361d5d320e670f0cd;p=horde.git Fix for Ticket #4221. Fix stripping attachments when saving to sent-mail folder when attaching the PGP public key. --- diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index c3475cfc7..d7061f07b 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -2,6 +2,8 @@ v5.0-cvs -------- +[mms] Fix stripping attachments when saving to sent-mail folder when attaching + the PGP public key (Bug #4221). [mms] Removed Special Characters menu. [mms] Add 'undelete' to Other Actions menu (Bug #7496) (DIMP). [mms] PGP functions now work in DIMP (Bug #5388). diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index edb6bfabf..6f44368d3 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -556,15 +556,17 @@ class IMP_Compose if (($save_attach == 'never') || ((strpos($save_attach, 'prompt') === 0) && empty($opts['save_attachments']))) { - foreach (array_keys($this->getAttachments()) as $i) { - $oldPart = $mime_message->getPart(++$i); - if ($oldPart !== false) { - $replace_part = new Horde_Mime_Part(); - $replace_part->setType('text/plain'); - $replace_part->setCharset($charset); - $replace_part->setContents('[' . _("Attachment stripped: Original attachment type") . ': "' . $oldPart->getType() . '", ' . _("name") . ': "' . $oldPart->getName(true) . '"]', '8bit'); - $mime_message->alterPart($i, $replace_part); + $mime_message->buildMimeIds(); + for ($i = 2; ; ++$i) { + if (!($oldPart = $mime_message->getPart($i))) { + break; } + + $replace_part = new Horde_Mime_Part(); + $replace_part->setType('text/plain'); + $replace_part->setCharset($charset); + $replace_part->setContents('[' . _("Attachment stripped: Original attachment type") . ': "' . $oldPart->getType() . '", ' . _("name") . ': "' . $oldPart->getName(true) . '"]', '8bit'); + $mime_message->alterPart($i, $replace_part); } }