From 5e9a5661011e64423e1978599c56d47f8b0cfa37 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Tue, 02 Mar 2010 02:54:11 -0500
Subject: [PATCH] Fix checking for new mail (#1485794)

---
 program/steps/mail/check_recent.inc |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc
index 7533040..4ae6ad2 100644
--- a/program/steps/mail/check_recent.inc
+++ b/program/steps/mail/check_recent.inc
@@ -22,6 +22,17 @@
 $a_mailboxes = $IMAP->list_mailboxes();
 $check_all = (bool)$RCMAIL->config->get('check_all_folders');
 
+// check if unread count of INBOX changed and refresh message list if so
+if (!empty($_GET['_refresh'])) {
+  $unread_count = $IMAP->messagecount('INBOX', 'UNSEEN', TRUE);
+  if ($unread_count > $_SESSION['unseen_count']['INBOX']) {
+    $OUTPUT->command('set_unread_count', 'INBOX', $unread_count, true);
+    $OUTPUT->command('list_mailbox', 'INBOX', 1);  // let the client switch to INBOX and get the message list
+    $OUTPUT->send();
+  }
+}
+
+// check recent/unseen counts for all mailboxes
 foreach ($a_mailboxes as $mbox_name) {
   if ($mbox_name == $IMAP->get_mailbox_name()) {
     if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE)) {

--
Gitblit v1.9.1