From f6b262a33aea33b040fd645505351cc8532b6410 Mon Sep 17 00:00:00 2001 From: stekkel Date: Sun, 23 May 2004 10:47:26 +0000 Subject: [PATCH] Fix broken thread sort git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7525 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mailbox_display.php | 39 +++++++++++++++-------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 5871b33f..db5bbcf6 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -544,9 +544,6 @@ function showMessagesForMailbox($imapConnection, $aMailbox) { // and use a properties array as function argument to provide user preferences global $data_dir, $username; - // retrieve indent array for thread sort - - /* if there's no messages in this folder */ if ($aMailbox['EXISTS'] == 0) { $string = '' . _("THIS FOLDER IS EMPTY") . ''; @@ -562,11 +559,9 @@ function showMessagesForMailbox($imapConnection, $aMailbox) { echo ' '; echo ' '; return; - } - - if ($aMailbox['EXISTS'] > 0) { - /* if $start_msg is lower than $num_msgs, we probably deleted all messages - * in the last page. We need to re-adjust the start_msg + } else { + /* + * Adjust the start_msg */ $start_msg = $aMailbox['PAGEOFFSET']; if($aMailbox['PAGEOFFSET'] > $aMailbox['EXISTS']) { @@ -585,20 +580,6 @@ function showMessagesForMailbox($imapConnection, $aMailbox) { if ($internaldate) { $aFetchItems[] = 'INTERNALDATE'; } - if ($aMailbox['SORT'] == SQSORT_NONE) { - /** - * retrieve messages by sequence id's and fetch the UID to retrieve - * the UID. for sorted lists this is not needed because a UID FETCH - * automaticly add the UID value in fetch results - **/ - $aFetchItems[] = 'UID'; - } - - /* This code and the next if() block check for - * server-side sorting methods. The $id array is - * formatted and $sort is set to 6 to disable - * SM internal sorting - */ if ($aMailbox['SORT'] != SQSORT_NONE && isset($aMailbox['UIDSET']) && $aMailbox['UIDSET'] ) { @@ -629,10 +610,23 @@ function showMessagesForMailbox($imapConnection, $aMailbox) { $msgs = sqimap_get_small_header_list($imapConnection,$id_slice,$aMailbox['LIMIT'], $aHeaderFields,$aFetchItems); } else { + // FIX ME do error handling return false; } + } else { + // FIX ME, format message and fallback to squirrel sort + if ($error) { + echo $error; + } } } else { + /** + * retrieve messages by sequence id's and fetch the UID to retrieve + * the UID. for sorted lists this is not needed because a UID FETCH + * automaticly add the UID value in fetch results + **/ + $aFetchItems[] = 'UID'; + //create id range $iRangeEnd = (($aMailbox['EXISTS'] - $aMailbox['OFFSET']) > $aMailbox['LIMIT']) ? $aMailbox['EXISTS'] - $aMailbox['OFFSET'] +1 - $aMailbox['LIMIT']: @@ -657,6 +651,7 @@ function showMessagesForMailbox($imapConnection, $aMailbox) { $aMailbox['UIDSET'] =& $id; $aMailbox['MSG_HEADERS'] =& $msgs; if ($aMailbox['SORT_METHOD'] == 'THREAD') { + // retrieve indent array for thread sort sqgetGlobalVar('indent_array',$indent_array,SQ_SESSION); $aMailbox['THREAD_INDENT'] =& $indent_array; } -- 2.25.1