On Feb 25, 2006, at 11:26 AM, Leonard Bouchet wrote:
Hi,
On 25 févr. 06, at 19:11, Thomas Bruederli wrote:
Any suggestions to improve this operation are welcome.
What about setting the prev/next ids in the row when you build the
list, and then passing this information back to the show_message
command?I just had a complete look at the code and it seems feasible with
some not so trivial modifications. Should I give it a try?
Just looking at the code in question, it looks like it builds a giant
array with the box's entire index data in it, which obviously will
grow along with the size of the mailbox:
// get previous and next message UID
$a_msg_index = $IMAP->message_index(NULL, $_SESSION['sort_col'],
$_SESSION['sort_order']);
$MESSAGE['index'] = array_search((string)$_GET['_uid'],
$a_msg_index, TRUE);
if (isset($a_msg_index[$MESSAGE['index']-1]))
$javascript .= sprintf("\n%s.set_env('prev_uid', '%s');",
$JS_OBJECT_NAME, $a_msg_index[$MESSAGE['index']-1]);
if (isset($a_msg_index[$MESSAGE['index']+1]))
$javascript .= sprintf("\n%s.set_env('next_uid', '%s');",
$JS_OBJECT_NAME, $a_msg_index[$MESSAGE['index']+1]);
Shouldn't there be a way to retrieve the UID's in question without
building an array of the entire mailbox? Or maybe I'm missing what
the code is doing.
I'm trying to figure out how the UID's get retrieved when the whole
mailbox is listed, because that's plenty fast. I'm getting lost in
the code though.
-- Mark Edwards