diff options
Diffstat (limited to 'program/steps/mail/getunread.inc')
-rw-r--r-- | program/steps/mail/getunread.inc | 11 |
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(); + ?> |