From: Michael M Slusarz Date: Wed, 1 Jul 2009 05:55:07 +0000 (-0600) Subject: Update to new Horde_Mime_Part API X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=097a4e204aae8a2c854f24dcabedaedd371bac17;p=horde.git Update to new Horde_Mime_Part API --- diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index d0fb5bffe..570ca2908 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -230,9 +230,9 @@ class IMP_Compose /* Need to add Message-ID so we can use it in the index search. */ $draft_headers->addMessageIdHeader(); - $draft_headers = $base->addMimeHeaders($draft_headers); + $draft_headers = $base->addMimeHeaders(array('headers' => $draft_headers)); - return $draft_headers->toString(array('charset' => $charset, 'defserver' => $session ? $_SESSION['imp']['maildomain'] : null)) . $base->toString(false); + return $draft_headers->toString(array('charset' => $charset, 'defserver' => $session ? $_SESSION['imp']['maildomain'] : null)) . $base->toString(array('headers' => false)); } /** @@ -592,7 +592,7 @@ class IMP_Compose /* Generate the message string. */ $fcc = $headers->toString(array('charset' => $charset, 'defserver' => $_SESSION['imp']['maildomain'])) . - $mime_message->toString(false); + $mime_message->toString(array('headers' => false)); $imp_folder = IMP_Folder::singleton(); @@ -1618,9 +1618,6 @@ class IMP_Compose $type = $part->getType(); $vfs = $conf['compose']['use_vfs']; - /* Decode the contents. */ - $part->transferDecodeContents(); - /* Try to determine the MIME type from 1) the extension and * then 2) analysis of the file (if available). */ if ($type == 'application/octet-stream') { diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index b17420d33..5b5d51bbe 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -163,7 +163,7 @@ class IMP_Contents public function getBody($options = array()) { if (is_null($this->_mailbox)) { - return $this->_message->toString(true, !empty($options['stream'])); + return $this->_message->toString(array('headers' => true, 'stream' => !empty($options['stream']))); } try { @@ -305,9 +305,6 @@ class IMP_Contents * DEFAULT: All data is retrieved. * 'nocontents' - (boolean) If true, don't add the contents to the part * DEFAULT: Contents are added to the part - * 'nodecode' - (boolean) If 'nocontents' is false, and this setting is - * true, does not transfer decode the contents. - * DEFAULT: Contents are transfer decoded. * * * @return Horde_Mime_Part The raw MIME part asked for (reference). @@ -325,12 +322,8 @@ class IMP_Contents !is_null($part) && empty($options['nocontents']) && !is_null($this->_mailbox) && - !$part->getContentsAsStream()) { - $part->setContents($this->getBodyPart($id, array('length' => empty($options['length']) ? null : $options['length'], 'stream' => true))); - - if (empty($options['nodecode'])) { - $part->transferDecodeContents(); - } + !$part->getContents(array('stream' => true))) { + $part->setContents($this->getBodyPart($id, array('length' => empty($options['length']) ? null : $options['length'], 'stream' => true)), array('usestream' => true)); } return $part; @@ -942,7 +935,7 @@ class IMP_Contents if (($key != 0) && ($val != 'message/rfc822') && (strpos($val, 'multipart/') === false)) { - $part = $this->getMIMEPart($key, array('nodecode' => true)); + $part = $this->getMIMEPart($key); $message->alterPart($key, $part); } } diff --git a/imp/lib/Message.php b/imp/lib/Message.php index 488581002..38d7957a6 100644 --- a/imp/lib/Message.php +++ b/imp/lib/Message.php @@ -536,7 +536,7 @@ class IMP_Message unset($res['flags'][$pos]); } - $uid = $GLOBALS['imp_imap']->ob->append($mbox, array(array('data' => $res['headertext'][0] . $message->toString(false), 'flags' => $res['flags'], 'messageid' => $res['envelope']['message-id']))); + $uid = $GLOBALS['imp_imap']->ob->append($mbox, array(array('data' => $res['headertext'][0] . $message->toString(array('headers' => false)), 'flags' => $res['flags'], 'messageid' => $res['envelope']['message-id']))); } catch (Horde_Imap_Client_Exception $e) { throw new Horde_Exception(_("An error occured while attempting to strip the attachment.")); } diff --git a/imp/view.php b/imp/view.php index 9f2db616d..0f1f8af7b 100644 --- a/imp/view.php +++ b/imp/view.php @@ -39,8 +39,8 @@ function _sanitizeName($name) function _fullMessageTextLength($ob) { - $stat = fstat($ob[1]); - $len = strlen($ob[0]) + $stat['size']); + $stat = fseek($ob[1], 0, SEEK_END); + $len = strlen($ob[0]) + ftell($ob[1]); rewind($ob[1]); return $len; } @@ -134,7 +134,7 @@ case 'download_render': $name .= '.zip'; $type = 'application/zip'; } else { - $body = $mime->getContentsAsStream(); + $body = $mime->getContents(array('stream' => true)); $type = $mime->getType(true); } break;