From 46f7b7096450939fe03c95aa81ce06ae4bfca89d Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Mon, 28 Mar 2016 06:51:43 -0400 Subject: [PATCH] Enable reply/reply-all/forward buttons also in preview frame of message/rfc822 --- program/lib/Roundcube/rcube_imap_cache.php | 41 ++++++++--------------------------------- 1 files changed, 8 insertions(+), 33 deletions(-) diff --git a/program/lib/Roundcube/rcube_imap_cache.php b/program/lib/Roundcube/rcube_imap_cache.php index 6ba6b8b..a402c18 100644 --- a/program/lib/Roundcube/rcube_imap_cache.php +++ b/program/lib/Roundcube/rcube_imap_cache.php @@ -1,6 +1,6 @@ <?php -/* +/** +-----------------------------------------------------------------------+ | This file is part of the Roundcube Webmail client | | Copyright (C) 2005-2012, The Roundcube Dev Team | @@ -99,7 +99,6 @@ ); - /** * Object constructor. * @@ -132,7 +131,6 @@ $this->messages_table = $db->table_name('cache_messages', true); } - /** * Cleanup actions (on shutdown). */ @@ -141,7 +139,6 @@ $this->save_icache(); $this->icache = null; } - /** * Set cache mode @@ -152,7 +149,6 @@ { $this->mode = $mode; } - /** * Return (sorted) messages index (UIDs). @@ -262,7 +258,6 @@ return $data; } - /** * Return messages thread. * If threaded index doesn't exist or is invalid, will be updated. @@ -317,7 +312,6 @@ return $index['object']; } - /** * Returns list of messages (headers). See rcube_imap::fetch_headers(). @@ -380,7 +374,6 @@ return $result; } - /** * Returns message data. @@ -448,7 +441,6 @@ return $message; } - /** * Saves the message in cache. @@ -522,7 +514,6 @@ $this->db->set_option('ignore_key_errors', false); } - /** * Sets the flag for specified message. * @@ -571,11 +562,9 @@ ." WHERE `user_id` = ?" ." AND `mailbox` = ?" .(!empty($uids) ? " AND `uid` IN (".$this->db->array2list($uids, 'integer').")" : "") - ." AND (`flags` & $idx) ".($enabled ? "= 0" : "= $idx"), ." AND " . sprintf($binary_check, $idx) . ($enabled ? " = 0" : " = $idx"), $this->userid, $mailbox); } - /** * Removes message(s) from cache. @@ -612,7 +601,6 @@ $this->userid, $mailbox); } } - /** * Clears index cache. @@ -653,7 +641,6 @@ } } - /** * Clears thread cache. * @@ -678,7 +665,6 @@ } } - /** * Clears the cache. * @@ -691,7 +677,6 @@ $this->remove_thread($mailbox); $this->remove_message($mailbox, $uids); } - /** * Delete expired cache entries @@ -711,7 +696,6 @@ $db->query("DELETE FROM ".$db->table_name('cache_thread', true) ." WHERE `expires` < $now"); } - /** * Fetches index data from database @@ -749,7 +733,6 @@ return null; } - /** * Fetches thread data from database */ @@ -782,7 +765,6 @@ return null; } - /** * Saves index data into database @@ -837,7 +819,6 @@ $this->db->set_option('ignore_key_errors', false); } - /** * Saves thread data into database */ @@ -887,7 +868,6 @@ $this->db->set_option('ignore_key_errors', false); } - /** * Checks index/thread validity @@ -1006,14 +986,13 @@ return false; } // ... and max UID - if ($object->max() != $this->imap->id2uid($mbox_data['EXISTS'], $mailbox, true)) { + if ($object->max() != $this->imap->id2uid($mbox_data['EXISTS'], $mailbox)) { return false; } } return true; } - /** * Synchronizes the mailbox. @@ -1191,7 +1170,6 @@ $this->icache[$mailbox]['index']['object'] = $data; } - /** * Converts cache row into message object. * @@ -1215,7 +1193,6 @@ return $message; } - /** * Saves message stored in internal cache */ @@ -1237,7 +1214,6 @@ } } - /** * Prepares message object to be stored in database. * @@ -1246,12 +1222,14 @@ private function message_object_prepare(&$msg, &$size = 0) { // Remove body too big - if ($msg->body && ($length = strlen($msg->body))) { - $size += $length; + if (isset($msg->body)) { + $length = strlen($msg->body); - if ($size > $this->threshold * 1024) { - $size -= $length; + if ($msg->body_modified || $size + $length > $this->threshold * 1024) { unset($msg->body); + } + else { + $size += $length; } } @@ -1275,7 +1253,6 @@ } } - /** * Fetches index data from IMAP server */ @@ -1296,7 +1273,6 @@ return $index; } - /** * Fetches thread data from IMAP server */ @@ -1313,7 +1289,6 @@ return new rcube_result_thread($mailbox, '* THREAD'); } - } // for backward compat. -- Gitblit v1.9.1