update Sat Mar 6 18:37:00 PST 2010
[pkgsrc.git] / mail / squirrelmail / patches / patch-ap
1 $NetBSD: patch-ap,v 1.1 2010/03/04 16:00:37 taca Exp $
2
3 --- functions/mailbox_display.php.orig  2009-08-12 17:29:53.000000000 +0900
4 +++ functions/mailbox_display.php
5 @@ -487,7 +487,7 @@ function showMessagesForMailbox($imapCon
6                  if (!$use_cache) {
7                      $msgs = getSelfSortMessages($imapConnection, $start_msg, $show_num,
8                                                  $num_msgs, $sort, $mbxresponse);
9 -                    $msort = calc_msort($msgs, $sort);
10 +                    $msort = calc_msort($msgs, $sort, $mailbox);
11                  } /* !use cache */
12                  break;
13          } // switch
14 @@ -545,7 +545,7 @@ function showMessagesForMailbox($imapCon
15      //echo("elapsed time = $t seconds\n");
16  }
17  
18 -function calc_msort($msgs, $sort) {
19 +function calc_msort($msgs, $sort, $mailbox = 'INBOX') {
20  
21      /*
22       * 0 = Date (up)
23 @@ -565,8 +565,9 @@ function calc_msort($msgs, $sort) {
24              $msort[] = $item['TIME_STAMP'];
25          }
26      } elseif (($sort == 2) || ($sort == 3)) {
27 +        $fld_sort = (handleAsSent($mailbox)?'TO-SORT':'FROM-SORT');
28          foreach ($msgs as $item) {
29 -            $msort[] = $item['FROM-SORT'];
30 +            $msort[] = $item[$fld_sort];
31          }
32      } elseif (($sort == 4) || ($sort == 5)) {
33          foreach ($msgs as $item) {