Aleksander Machniak
2012-12-18 d2534c63f2c0b640a39fce2a71b14a5dcda6e7fd
program/lib/Roundcube/rcube_message.php
@@ -2,8 +2,6 @@
/*
 +-----------------------------------------------------------------------+
 | program/include/rcube_message.php                                     |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2008-2010, The Roundcube Dev Team                       |
 |                                                                       |
@@ -18,7 +16,6 @@
 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
 +-----------------------------------------------------------------------+
*/
/**
 * Logical representation of a mail message with all its data
@@ -173,10 +170,11 @@
     * @param string   $mime_id           Part MIME-ID
     * @param resource $fp File           pointer to save the message part
     * @param boolean  $skip_charset_conv Disables charset conversion
     * @param int      $max_bytes         Only read this number of bytes
     *
     * @return string Part content
     */
    public function get_part_content($mime_id, $fp = null, $skip_charset_conv = false)
    public function get_part_content($mime_id, $fp = null, $skip_charset_conv = false, $max_bytes = 0)
    {
        if ($part = $this->mime_parts[$mime_id]) {
            // stored in message structure (winmail/inline-uuencode)
@@ -190,7 +188,7 @@
            // get from IMAP
            $this->storage->set_folder($this->folder);
            return $this->storage->get_message_part($this->uid, $mime_id, $part, NULL, $fp, $skip_charset_conv);
            return $this->storage->get_message_part($this->uid, $mime_id, $part, NULL, $fp, $skip_charset_conv, $max_bytes);
        }
    }
@@ -319,8 +317,15 @@
    private function parse_structure($structure, $recursive = false)
    {
        // real content-type of message/rfc822 part
        if ($structure->mimetype == 'message/rfc822' && $structure->real_mimetype)
        if ($structure->mimetype == 'message/rfc822' && $structure->real_mimetype) {
            $mimetype = $structure->real_mimetype;
            // parse headers from message/rfc822 part
            if (!isset($structure->headers['subject'])) {
                list($headers, $dump) = explode("\r\n\r\n", $this->get_part_content($structure->mime_id, null, true, 4096));
                $structure->headers = rcube_mime::parse_headers($headers);
            }
        }
        else
            $mimetype = $structure->mimetype;