summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-04-23 11:47:24 +0000
committeralecpl <alec@alec.pl>2010-04-23 11:47:24 +0000
commita03c98092f7bdb98347876a1a1a4716dfe46be89 (patch)
treebf170aca37de89ab1b5a41a764f60d735594afdc /program/include
parent2eb7943f2aeaec8efc74b16b7bedb56da9913abf (diff)
- fix IMAP errors on Settings/Folders (always call _id2uid() with mailbox set)
- performance: add option to not checking MAXUID in messagecount()
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_imap.php29
1 files changed, 16 insertions, 13 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 466c47a3a..e33484cb7 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -408,16 +408,17 @@ class rcube_imap
/**
* Get message count for a specific mailbox
*
- * @param string Mailbox/folder name
- * @param string Mode for count [ALL|THREADS|UNSEEN|RECENT]
- * @param boolean Force reading from server and update cache
- * @return int Number of messages
- * @access public
+ * @param string Mailbox/folder name
+ * @param string Mode for count [ALL|THREADS|UNSEEN|RECENT]
+ * @param boolean Force reading from server and update cache
+ * @param boolean Enables MAXUIDs checking
+ * @return int Number of messages
+ * @access public
*/
- function messagecount($mbox_name='', $mode='ALL', $force=false)
+ function messagecount($mbox_name='', $mode='ALL', $force=false, $maxuid=true)
{
$mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox;
- return $this->_messagecount($mailbox, $mode, $force);
+ return $this->_messagecount($mailbox, $mode, $force, $maxuid);
}
@@ -427,7 +428,7 @@ class rcube_imap
* @access private
* @see rcube_imap::messagecount()
*/
- private function _messagecount($mailbox='', $mode='ALL', $force=false)
+ private function _messagecount($mailbox='', $mode='ALL', $force=false, $maxuid=true)
{
$mode = strtoupper($mode);
@@ -453,7 +454,8 @@ class rcube_imap
if ($mode == 'THREADS') {
$count = $this->_threadcount($mailbox, $msg_count);
- $_SESSION['maxuid'][$mailbox] = $msg_count ? $this->_id2uid($msg_count) : 0;
+ if ($maxuid)
+ $_SESSION['maxuid'][$mailbox] = $msg_count ? $this->_id2uid($msg_count, $mailbox) : 0;
}
// RECENT count is fetched a bit different
else if ($mode == 'RECENT') {
@@ -477,15 +479,16 @@ class rcube_imap
$count = is_array($index) ? count($index) : 0;
- if ($mode == 'ALL')
- $_SESSION['maxuid'][$mailbox] = $index ? $this->_id2uid(max($index)) : 0;
+ if ($mode == 'ALL' && $maxuid)
+ $_SESSION['maxuid'][$mailbox] = $index ? $this->_id2uid(max($index), $mailbox) : 0;
}
else {
if ($mode == 'UNSEEN')
$count = $this->conn->countUnseen($mailbox);
else {
$count = $this->conn->countMessages($mailbox);
- $_SESSION['maxuid'][$mailbox] = $count ? $this->_id2uid($count) : 0;
+ if ($maxuid)
+ $_SESSION['maxuid'][$mailbox] = $count ? $this->_id2uid($count, $mailbox) : 0;
}
}
@@ -1571,7 +1574,7 @@ class rcube_imap
function get_headers($id, $mbox_name=NULL, $is_uid=true, $bodystr=false)
{
$mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox;
- $uid = $is_uid ? $id : $this->_id2uid($id);
+ $uid = $is_uid ? $id : $this->_id2uid($id, $mailbox);
// get cached headers
if ($uid && ($headers = &$this->get_cached_message($mailbox.'.msg', $uid)))