summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/include/rcube_imap.php29
-rw-r--r--program/steps/settings/manage_folders.inc2
2 files changed, 17 insertions, 14 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)))
diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc
index 9202777f7..54dd0bd92 100644
--- a/program/steps/settings/manage_folders.inc
+++ b/program/steps/settings/manage_folders.inc
@@ -291,7 +291,7 @@ function rcube_subscription_form($attrib)
$table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes)));
$table->add('name', Q($display_folder));
- $table->add('msgcount', ($folder['virtual'] ? '' : $IMAP->messagecount($folder['id']))); // XXX: Use THREADS or ALL?
+ $table->add('msgcount', ($folder['virtual'] ? '' : $IMAP->messagecount($folder['id'], 'ALL', false, false)));
$table->add('subscribed', ($protected || $folder['virtual']) ? ($subscribed ? ' •' : ' ') :
$checkbox_subscribe->show(($subscribed ? $folder_utf8 : ''), array('value' => $folder_utf8)));
if ($threading_supported) {