From 47672bfda519f6663c9a92b1039d45d9775bbc0d Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Fri, 16 Sep 2011 15:08:07 -0400 Subject: [PATCH] Trigger 'new_messages' hook for all checked folders (#1488083) --- CHANGELOG | 1 + program/steps/mail/check_recent.inc | 18 ++++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f6ab58b..1d8b0b3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Trigger 'new_messages' hook for all checked folders (#1488083) - Fix session race conditions when composing new messages - Fix encoding of LDAP contacts identifiers (#1488079) - jQuery 1.6.4 diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc index d79359f..0eab345 100644 --- a/program/steps/mail/check_recent.inc +++ b/program/steps/mail/check_recent.inc @@ -34,10 +34,16 @@ // check recent/unseen counts foreach ($a_mailboxes as $mbox_name) { - if ($mbox_name == $current && ($status = $IMAP->mailbox_status($mbox_name))) { + $status = $IMAP->mailbox_status($mbox_name); - rcmail_send_unread_count($mbox_name, true); + if ($status & 1) { + // trigger plugin hook + $RCMAIL->plugins->exec_hook('new_messages', array('mailbox' => $mbox_name)); + } + rcmail_send_unread_count($mbox_name, true); + + if ($status && $mbox_name == $current) { // refresh saved search set $search_request = get_input_value('_search', RCUBE_INPUT_GPC); if ($search_request && isset($_SESSION['search']) @@ -70,11 +76,6 @@ $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($all_count)); $OUTPUT->set_env('current_page', $all_count ? $IMAP->list_page : 1); - if ($status & 1) { - // trigger plugin hook - $RCMAIL->plugins->exec_hook('new_messages', array('mailbox' => $mbox_name)); - } - // remove old rows (and clear selection if new list is empty) $OUTPUT->command('message_list.clear', $all_count ? false : true); @@ -85,9 +86,6 @@ // remove messages that don't exists from list selection array $OUTPUT->command('update_selection'); } - } - else { - rcmail_send_unread_count($mbox_name, true); } } -- Gitblit v1.9.1