From b550c2eaa5a36d460d859bdf10b5bd88ff2d7ebe Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 25 Jun 2009 15:45:39 -0400
Subject: [PATCH] - fix rcube_message_part cloning

---
 program/include/rcube_imap.php |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 556c8b0..8ffcfe0 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -938,7 +938,7 @@
       if ($headers = iil_C_FetchHeader($this->conn, $mailbox, join(',', $for_update), false, $this->fetch_add_headers))
         foreach ($headers as $header)
           $this->add_message_cache($cache_key, $header->id, $header, NULL,
-		in_array((string)$header->uid, $for_remove, true));
+		in_array((string)$header->uid, (array)$for_remove, true));
       }
     }
 
@@ -2291,8 +2291,7 @@
     {
     $internal_key = '__single_msg';
     
-    if ($this->caching_enabled && (!isset($this->cache[$internal_key][$uid]) ||
-        ($struct && empty($this->cache[$internal_key][$uid]->structure))))
+    if ($this->caching_enabled && !isset($this->cache[$internal_key][$uid]))
       {
       $sql_result = $this->db->query(
         "SELECT idx, headers, structure
@@ -3037,6 +3036,13 @@
   var $d_parameters = array();
   var $ctype_parameters = array();
 
+  function __clone()
+  {
+    if (isset($this->parts))
+      foreach ($this->parts as $idx => $part)
+        if (is_object($part))
+	  $this->parts[$idx] = clone $part;
+  }				
 }
 
 

--
Gitblit v1.9.1