summaryrefslogtreecommitdiff
path: root/program/steps/mail/getunread.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-09-17 12:07:58 +0000
committeralecpl <alec@alec.pl>2009-09-17 12:07:58 +0000
commit78925f8f1a9afb9475a9cf9ad1b35daade23da85 (patch)
treee17493f32eb5f11a6faa77ff64ef7f81a1e0c469 /program/steps/mail/getunread.inc
parent20e251599fa595102188bffb9fc5ffc4a1ca0166 (diff)
- Fix incorrect count of new messages in folder list when using multiple IMAP clients (#1485995)
- Fix all folders checking for new messages with disabled caching (#1486128)
Diffstat (limited to 'program/steps/mail/getunread.inc')
-rw-r--r--program/steps/mail/getunread.inc11
1 files changed, 9 insertions, 2 deletions
diff --git a/program/steps/mail/getunread.inc b/program/steps/mail/getunread.inc
index 145930c49..bee2073e3 100644
--- a/program/steps/mail/getunread.inc
+++ b/program/steps/mail/getunread.inc
@@ -24,9 +24,16 @@ $a_folders = $IMAP->list_mailboxes();
if (!empty($a_folders))
{
$inbox = ($IMAP->get_mailbox_name() == 'INBOX');
- foreach ($a_folders as $mbox_row)
- $OUTPUT->command('set_unread_count', $mbox_row, $IMAP->messagecount($mbox_row, 'UNSEEN'), $inbox && $mbox_row == 'INBOX');
+ foreach ($a_folders as $mbox_row) {
+ $unseen = $IMAP->messagecount($mbox_row, 'UNSEEN', !isset($_SESSION['unseen_count'][$mbox_row]));
+ $_SESSION['unseen_count'][$mbox_row] = $unseen;
+
+ if ($unseen) {
+ $OUTPUT->command('set_unread_count', $mbox_row, $unseen, $inbox && $mbox_row == 'INBOX');
+ }
+ }
}
$OUTPUT->send();
+
?>