diff options
author | alecpl <alec@alec.pl> | 2009-09-17 12:07:58 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2009-09-17 12:07:58 +0000 |
commit | 78925f8f1a9afb9475a9cf9ad1b35daade23da85 (patch) | |
tree | e17493f32eb5f11a6faa77ff64ef7f81a1e0c469 /program/steps/mail/check_recent.inc | |
parent | 20e251599fa595102188bffb9fc5ffc4a1ca0166 (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/check_recent.inc')
-rw-r--r-- | program/steps/mail/check_recent.inc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc index 78b7fbbdf..d091d611b 100644 --- a/program/steps/mail/check_recent.inc +++ b/program/steps/mail/check_recent.inc @@ -68,12 +68,30 @@ foreach ($a_mailboxes as $mbox_name) { rcmail_js_message_list($result_h, true, false); } } + else { + send_unread_count($mbox_name); + } } - else if ($unseen = $IMAP->messagecount($mbox_name, 'UNSEEN', $check_all)) { - $OUTPUT->command('set_unread_count', $mbox_name, $unseen); + else if ($check_all) { + send_unread_count($mbox_name); } } $OUTPUT->send(); + +function send_unread_count($mbox_name) +{ + global $RCMAIL; + + $old_unseen = $_SESSION['unseen_count'][$mbox_name]; + $unseen = $RCMAIL->imap->messagecount($mbox_name, 'UNSEEN', true); + + if ($unseen != $old_unseen) + $RCMAIL->output->command('set_unread_count', $mbox_name, $unseen, ($mbox_name == 'INBOX')); + + // @TODO: this data is doubled (session and cache tables) if caching is enabled + $_SESSION['unseen_count'][$mbox_name] = $unseen; +} + ?> |