From c4e7e4f8221f7eb229c1186729424e9ce6ccee16 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 02 Aug 2006 18:05:42 -0400
Subject: [PATCH] Message sorting: added patch by Eric; fixed check-for-recent confusion
---
program/steps/mail/check_recent.inc | 6 +++++-
program/include/rcube_imap.inc | 39 +++++++++++++++------------------------
2 files changed, 20 insertions(+), 25 deletions(-)
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index 630d2fb..b374257 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -516,32 +516,33 @@
$a_msg_headers = $this->get_message_cache($cache_key, $start_msg, $start_msg+$this->page_size, $this->sort_field, $this->sort_order);
$headers_sorted = TRUE;
}
+ // cache is dirty, sync it
+ else if ($this->caching_enabled && $cache_status==-1 && !$recursive)
+ {
+ $this->sync_header_index($mailbox);
+ return $this->_list_headers($mailbox, $page, $this->sort_field, $this->sort_order, TRUE);
+ }
else
{
- $sorter = new rcube_header_sorter();
-
// retrieve headers from IMAP
if ($this->get_capability('sort') && ($msg_index = iil_C_Sort($this->conn, $mailbox, $this->sort_field, $this->skip_deleted ? 'UNDELETED' : '')))
- {
- $sorter->set_sequence_numbers($msg_index);
-
+ {
$msgs = $msg_index[$begin];
for ($i=$begin+1; $i < $end; $i++)
$msgs = $msgs.','.$msg_index[$i];
}
else
{
- $msgs = sprintf("%d:%d", $begin+1, $end);
+ $msgs = sprintf("%d:%d", $begin+1, $end);
+
+ $i = 0;
+ for ($msg_seqnum = $begin; $msg_seqnum <= $end; $msg_seqnum++)
+ $msg_index[$i++] = $msg_seqnum;
}
-
- // cache is dirty, sync it
- if ($this->caching_enabled && $cache_status==-1 && !$recursive)
- {
- $this->sync_header_index($mailbox);
- return $this->_list_headers($mailbox, $page, $this->sort_field, $this->sort_order, TRUE);
- }
-
+ // use this class for message sorting
+ $sorter = new rcube_header_sorter();
+ $sorter->set_sequence_numbers($msg_index);
// fetch reuested headers from server
$a_msg_headers = array();
@@ -573,16 +574,6 @@
return array_values($a_msg_headers);
}
-
-
-
-
-
-function gethdrids($hdr)
-{
- return $hdr->uid . ',' . $hdr->id;
-}
-
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc
index f949eb2..5846699 100644
--- a/program/steps/mail/check_recent.inc
+++ b/program/steps/mail/check_recent.inc
@@ -40,7 +40,11 @@
// add new message headers to list
$a_headers = array();
for ($i=$recent_count, $id=$count-$recent_count+1; $i>0; $i--, $id++)
- $a_headers[] = $IMAP->get_headers($id, NULL, FALSE);
+ {
+ $header = $IMAP->get_headers($id, NULL, FALSE);
+ if ($header->recent)
+ $a_headers[] = $header;
+ }
$commands .= rcmail_js_message_list($a_headers, TRUE);
}
--
Gitblit v1.9.1