[Svn] r3710 - trunk/roundcubemail/program/steps/mail

trac at roundcube.net trac at roundcube.net
Fri Jun 4 09:18:26 CEST 2010


Author: alec
Date: 2010-06-04 02:18:26 -0500 (Fri, 04 Jun 2010)
New Revision: 3710

Modified:
   trunk/roundcubemail/program/steps/mail/func.inc
   trunk/roundcubemail/program/steps/mail/list.inc
Log:
- Skip UNSEEN counting when list is empty


Modified: trunk/roundcubemail/program/steps/mail/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/func.inc	2010-06-04 07:05:06 UTC (rev 3709)
+++ trunk/roundcubemail/program/steps/mail/func.inc	2010-06-04 07:18:26 UTC (rev 3710)
@@ -551,13 +551,17 @@
 }
 
 
-function rcmail_send_unread_count($mbox_name, $force=false)
+function rcmail_send_unread_count($mbox_name, $force=false, $count=null)
 {
   global $RCMAIL;
 
   $old_unseen = $_SESSION['unseen_count'][$mbox_name];
-  $unseen = $RCMAIL->imap->messagecount($mbox_name, 'UNSEEN', $force);
 
+  if ($count === null)
+    $unseen = $RCMAIL->imap->messagecount($mbox_name, 'UNSEEN', $force);
+  else
+    $unseen = $count;
+
   if ($unseen != $old_unseen || ($mbox_name == 'INBOX'))
     $RCMAIL->output->command('set_unread_count', $mbox_name, $unseen, ($mbox_name == 'INBOX'));
 

Modified: trunk/roundcubemail/program/steps/mail/list.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/list.inc	2010-06-04 07:05:06 UTC (rev 3709)
+++ trunk/roundcubemail/program/steps/mail/list.inc	2010-06-04 07:18:26 UTC (rev 3710)
@@ -70,8 +70,13 @@
 if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']]))
   $_SESSION['search'][$_REQUEST['_search']] = $IMAP->get_search_set();
 
+// empty result? we'll skip UNSEEN counting in rcmail_send_unread_count()
+if (empty($search_request) && empty($a_headers)) {
+    $unseen = 0;
+}
+
 // update mailboxlist
-rcmail_send_unread_count($mbox_name, !empty($_REQUEST['_refresh']));
+rcmail_send_unread_count($mbox_name, !empty($_REQUEST['_refresh']), $unseen);
 
 // update message count display
 $pages = ceil($count/$IMAP->page_size);

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list