advanced_tree: sort mailboxes naturally, handle special folders the same as in oldway...
authoralex-brainstorm <alex-brainstorm@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 22 Aug 2003 01:28:16 +0000 (01:28 +0000)
committeralex-brainstorm <alex-brainstorm@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 22 Aug 2003 01:28:16 +0000 (01:28 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5545 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_mailbox.php

index 1a95765661b09163b2f146281c73432339d0a4ec..18af1782f7a42f8626a45d390e35f31862d99c7e 100755 (executable)
@@ -79,8 +79,7 @@ function sortSpecialMbx($a, $b) {
     } else {
         $bcmp = '2' . $b->mailboxname_full;
     }
-    if ($acmp == $bcmp) return 0;
-    return ($acmp > $bcmp) ? 1: -1;
+    return user_strcasecmp($acmp, $bcmp);      
 }
 
 function compact_mailboxes_response($ary)
@@ -836,7 +835,7 @@ function sqimap_fill_mailbox_tree($mbx_ary, $mbxs=false,$imap_stream) {
                 the list, despite having "special folders at top" option set.
                 Need a better method than this.
             */
-
+/*
             if ($mailbox == 'INBOX') {
                 $mbx->is_special = true;
             } elseif (stristr($trash_folder , $mailbox)) {
@@ -851,7 +850,7 @@ function sqimap_fill_mailbox_tree($mbx_ary, $mbxs=false,$imap_stream) {
                 case 'INBOX':
                     $mbx->is_inbox = true;
                     $mbx->is_special = true;
-                   $mbx_ary[$i]['noselect'] = false;
+                    $mbx_ary[$i]['noselect'] = false;
                     break;
                 case $trash_folder:
                     $mbx->is_trash = true;
@@ -866,6 +865,13 @@ function sqimap_fill_mailbox_tree($mbx_ary, $mbxs=false,$imap_stream) {
                     $mbx->is_special = true;
                     break;
             }
+*/
+            $mbx->is_special |= ($mbx->is_inbox = (strtoupper($mailbox) == 'INBOX'));
+            $mbx->is_special |= ($mbx->is_trash = isTrashMailbox($mailbox));
+            $mbx->is_special |= ($mbx->is_sent = isSentMailbox($mailbox));
+            $mbx->is_special |= ($mbx->is_draft = isDraftMailbox($mailbox));
+            if (!$mbx->is_special)
+                $mbx->is_special = do_hook_function('special_mailbox', $mailbox);
             
             if (isset($mbx_ary[$i]['unseen'])) {
                 $mbx->unseen = $mbx_ary[$i]['unseen'];