diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/lib/Roundcube/rcube_imap.php | 10 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_storage.php | 5 | ||||
-rw-r--r-- | program/steps/mail/check_recent.inc | 4 |
3 files changed, 12 insertions, 7 deletions
diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php index 8d9c37576..0aa059c26 100644 --- a/program/lib/Roundcube/rcube_imap.php +++ b/program/lib/Roundcube/rcube_imap.php @@ -1096,16 +1096,17 @@ class rcube_imap extends rcube_storage /** - * Returns current status of folder + * Returns current status of a folder (compared to the last time use) * * We compare the maximum UID to determine the number of * new messages because the RECENT flag is not reliable. * * @param string $folder Folder name + * @param array $diff Difference data * - * @return int Folder status + * @return int Folder status */ - public function folder_status($folder = null) + public function folder_status($folder = null, &$diff = array()) { if (!strlen($folder)) { $folder = $this->folder; @@ -1126,6 +1127,9 @@ class rcube_imap extends rcube_storage // got new messages if ($new['maxuid'] > $old['maxuid']) { $result += 1; + // get new message UIDs range, that can be used for example + // to get the data of these messages + $diff['new'] = ($old['maxuid'] + 1 < $new['maxuid'] ? ($old['maxuid']+1).':' : '') . $new['maxuid']; } // some messages has been deleted if ($new['cnt'] < $old['cnt']) { diff --git a/program/lib/Roundcube/rcube_storage.php b/program/lib/Roundcube/rcube_storage.php index 8a36f1f9d..700d12ffb 100644 --- a/program/lib/Roundcube/rcube_storage.php +++ b/program/lib/Roundcube/rcube_storage.php @@ -807,13 +807,14 @@ abstract class rcube_storage /** - * Returns current status of a folder + * Returns current status of a folder (compared to the last time use) * * @param string $folder Folder name + * @param array $diff Difference data * * @return int Folder status */ - abstract function folder_status($folder = null); + abstract function folder_status($folder = null, &$diff = array()); /** diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc index d3c14a38d..3649d148c 100644 --- a/program/steps/mail/check_recent.inc +++ b/program/steps/mail/check_recent.inc @@ -52,12 +52,12 @@ foreach ($a_mailboxes as $mbox_name) { } // Get mailbox status - $status = $RCMAIL->storage->folder_status($mbox_name); + $status = $RCMAIL->storage->folder_status($mbox_name, $diff); if ($status & 1) { // trigger plugin hook $RCMAIL->plugins->exec_hook('new_messages', - array('mailbox' => $mbox_name, 'is_current' => $is_current)); + array('mailbox' => $mbox_name, 'is_current' => $is_current, 'diff' => $diff)); } rcmail_send_unread_count($mbox_name, true, null, |