summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_imap.php
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-09-16 08:49:28 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-09-16 08:49:28 +0000
commit616bdc036894401319b29a020fdb69bee4788064 (patch)
tree84c964e037f3e1e35642de4e010f172a88db1fc8 /roundcubemail/program/include/rcube_imap.php
parent36bc3d73d08829407e8f5f48e555fd3569c4de0c (diff)
- Reduced memory footprint when forwarding attachments (#1485345)
- Fixed endless loop in iil_C_HandlePartBody() - rcube_message::get_part_content() speed up using 3rd argument of rcube_imap::get_message_part() git-svn-id: https://svn.roundcube.net/trunk@1800 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_imap.php')
-rw-r--r--roundcubemail/program/include/rcube_imap.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php
index 1b5ec1670..54f0757b7 100644
--- a/roundcubemail/program/include/rcube_imap.php
+++ b/roundcubemail/program/include/rcube_imap.php
@@ -1283,9 +1283,10 @@ class rcube_imap
* @param string Part number
* @param object rcube_message_part Part object created by get_structure()
* @param mixed True to print part, ressource to write part contents in
+ * @param resource File pointer to save the message part
* @return string Message/part body if not printed
*/
- function &get_message_part($uid, $part=1, $o_part=NULL, $print=NULL)
+ function &get_message_part($uid, $part=1, $o_part=NULL, $print=NULL, $fp=NULL)
{
if (!($msg_id = $this->_uid2id($uid)))
return FALSE;
@@ -1293,6 +1294,7 @@ class rcube_imap
// get part encoding if not provided
if (!is_object($o_part))
{
+ write_log('errors', 'get_message_part: !is_object');
$structure_str = iil_C_FetchStructureString($this->conn, $this->mailbox, $msg_id);
$structure = iml_GetRawStructureArray($structure_str);
$part_type = iml_GetPartTypeCode($structure, $part);
@@ -1318,7 +1320,10 @@ class rcube_imap
}
else
{
- $body = iil_C_HandlePartBody($this->conn, $this->mailbox, $msg_id, $part, 1);
+ if ($fp && $o_part->encoding == 'base64')
+ return iil_C_HandlePartBody($this->conn, $this->mailbox, $msg_id, $part, 3, $fp);
+ else
+ $body = iil_C_HandlePartBody($this->conn, $this->mailbox, $msg_id, $part, 1);
// decode part body
if ($o_part->encoding)
@@ -1333,8 +1338,14 @@ class rcube_imap
$body = rcube_charset_convert($body, $o_part->charset);
}
+
+ if ($fp)
+ {
+ fwrite($fp, $body);
+ return true;
+ }
}
-
+
return $body;
}