summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2007-11-25 20:40:10 +0000
committerthomascube <thomas@roundcube.net>2007-11-25 20:40:10 +0000
commit11074801923807a9448f7427299ddba76e235e42 (patch)
treee674b11f1ead956a19b3eba3c132b5e0442fd53d /program/steps
parentd5342aabcfeddb959cc286befe6de5bf35fe9d76 (diff)
Only show new messages if they match the current search (#1484176)
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/check_recent.inc14
-rw-r--r--program/steps/mail/list.inc3
-rw-r--r--program/steps/mail/move_del.inc2
3 files changed, 14 insertions, 5 deletions
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc
index a2100f1d2..a392cd0e6 100644
--- a/program/steps/mail/check_recent.inc
+++ b/program/steps/mail/check_recent.inc
@@ -27,18 +27,26 @@ foreach ($a_mailboxes as $mbox_name)
{
if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE))
{
- $count = $IMAP->messagecount(NULL, 'ALL', TRUE);
+ // refresh saved search set
+ if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set)
+ $_SESSION['search'][$search_request] = $IMAP->refresh_search();
+
+ $count_all = $IMAP->messagecount(NULL, 'ALL', TRUE);
$unread_count = $IMAP->messagecount(NULL, 'UNSEEN', TRUE);
- $OUTPUT->set_env('messagecount', $count);
+ $OUTPUT->set_env('messagecount', $IMAP->messagecount());
$OUTPUT->command('set_unread_count', $mbox_name, $unread_count, true);
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text());
$OUTPUT->command('set_quota', $IMAP->get_quota());
// add new message headers to list
$a_headers = array();
- for ($i=$recent_count, $id=$count-$recent_count+1; $i>0; $i--, $id++)
+ for ($i=$recent_count, $id=$count_all-$recent_count+1; $i>0; $i--, $id++)
{
+ // skip message if it does not match the current search
+ if (!$IMAP->in_searchset($id))
+ continue;
+
$header = $IMAP->get_headers($id, NULL, FALSE);
if ($header->recent)
$a_headers[] = $header;
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index 196144285..8caf4c06f 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -40,9 +40,10 @@ else
$mbox_name = $IMAP->get_mailbox_name();
// fetch message headers
-if ($count = $IMAP->messagecount($mbox_name, 'ALL', !empty($_REQUEST['_refresh'])))
+if ($IMAP->messagecount($mbox_name, 'ALL', !empty($_REQUEST['_refresh'])))
$a_headers = $IMAP->list_headers($mbox_name, NULL, $sort_col, $sort_order);
+$count = $IMAP->messagecount($mbox_name);
$unseen = $IMAP->messagecount($mbox_name, 'UNSEEN', !empty($_REQUEST['_refresh']));
// update message count display
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index ff6117d21..c78d6db51 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -60,7 +60,7 @@ else if ($_action=='delete' && !empty($_POST['_uid']))
else
exit;
-// refresh saved seach set after moving some messages
+// refresh saved search set after moving some messages
if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set)
$_SESSION['search'][$search_request] = $IMAP->refresh_search();