this is a fix for the LSUB with a % when getting the folder list. This makes the...
authorjmunro <jmunro@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 11 Jun 2002 14:52:54 +0000 (14:52 +0000)
committerjmunro <jmunro@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 11 Jun 2002 14:52:54 +0000 (14:52 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2944 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/conf.pl
config/config_default.php
functions/imap_mailbox.php

index 7802bcfa01b7846508f1e3bd63d3937665e81c49..87534d770e6b9279cf6bb5a46f8facc0b759907c 100755 (executable)
@@ -278,6 +278,9 @@ if ( !$default_use_mdn ) {
 if ( !$delete_folder ) {
     $delete_folder = "false";
 }
+if ( !$noselect_fix_enable ) {
+    $noselect_fix_enable = "false";
+}
 if ( !$frame_top ) {
     $frame_top = "_top";
 }
@@ -410,6 +413,7 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
         print "15. Default Unseen Type           : $WHT$default_unseen_type$NRM\n";
         print "16. Auto Create Special Folders   : $WHT$auto_create_special$NRM\n";
         print "17. Don't move folders into Trash : $WHT$delete_folder$NRM\n";
+        print "18. Enable /NoSelect folder fix   : $WHT$noselect_fix_enable$NRM\n";
         print "\n";
         print "R   Return to Main Menu\n";
     } elsif ( $menu == 4 ) {
@@ -596,6 +600,7 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
             elsif ( $command == 15 ) { $default_unseen_type            = command213(); }
             elsif ( $command == 16 ) { $auto_create_special            = command214(); }
             elsif ( $command == 17 ) { $delete_folder                  = command215(); }
+            elsif ( $command == 18 ) { $noselect_fix_enable            = command216(); }
         } elsif ( $menu == 4 ) {
             if    ( $command == 1 )  { $default_charset          = command31(); }
             elsif ( $command == 2 )  { $data_dir                 = command33a(); }
@@ -1463,6 +1468,27 @@ sub command215 {
     return $delete_folder;
 }
 
+#noselect fix
+sub command216 {
+    print "Some IMAP server allow subfolders to exist even if the parent\n";
+    print "folders do not. This fixes some problems with the folder list\n";
+    print "when this is the case, causing the /NoSelect folders to be displayed\n";
+    print "\n";
+
+    if ( lc($noselect_fix_enable) eq "true" ) {
+        $default_value = "y";
+    } else {
+        $default_value = "n";
+    }
+    print "enable noselect fix? (y/n) [$WHT$noselect_fix_enable$NRM]: $WHT";
+    $noselect_fix_enable = <STDIN>;
+    if ( ( $noselect_fix_enable =~ /^y\n/i ) || ( ( $noselect_fix_enable =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+        $noselect_fix_enable = "true";
+    } else {
+        $noselect_fix_enable = "false";
+    }
+    return $noselect_fix_enable;
+}
 ############# GENERAL OPTIONS #####################
 
 # Default Charset
@@ -2321,6 +2347,9 @@ sub save_data {
         print CF "\$auto_create_special            = $auto_create_special;\n";
        # boolean
         print CF "\$delete_folder                  = $delete_folder;\n";
+    # boolean
+        print CF "\$noselect_fix_enable            = $noselect_fix_enable;\n";
+
         print CF "\n";
 
        # string
index b4aceb6be000fe5f82aa3fc81c0ffa6c81236d3c..656c9ddfccb6204dcfbe0501a1f84b8cfb2ce348 100644 (file)
@@ -488,9 +488,18 @@ $allow_thread_sort = false;
  * Your IMAP server must support the SORT extension for this
  * to work.
  */
+
 global $allow_server_sort;
 $allow_server_sort = false;
 
+/**
+ * This enables the no select fix for Cyrus when subfolders
+ * exist but parent folders do not
+ */
+
+global $noselect_fix_enable;
+$noselect_fix_enable = false;
+
 /**
  * Make sure there are no characters after the PHP closing
  * tag below (including newline characters and whitespace).
index 5594e78ff01b7baa55f6cc58922c471cf5132931..53a586d2490914f402140ffd919aa3c28dcf996a 100755 (executable)
@@ -444,7 +444,7 @@ function sqimap_mailbox_list($imap_stream) {
         global $data_dir, $username, $list_special_folders_first,
                $folder_prefix, $trash_folder, $sent_folder, $draft_folder,
                $move_to_trash, $move_to_sent, $save_as_draft,
-               $delimiter;
+               $delimiter, $noselect_fix_enable;
 
         $inbox_in_list = false;
         $inbox_subscribed = false;
@@ -452,10 +452,17 @@ function sqimap_mailbox_list($imap_stream) {
         require_once('../src/load_prefs.php');
         require_once('../functions/array.php');
 
+    if ($noselect_fix_enable) {
+        $lsub_args = "LSUB \"$folder_prefix\" \"*%\"";
+    }
+    else {
+        $lsub_args = "LSUB \"$folder_prefix\" \"*\"";
+    }
         /* LSUB array */
-        $lsub_ary = sqimap_run_command ($imap_stream, "LSUB \"$folder_prefix\" \"*%\"",
+        $lsub_ary = sqimap_run_command ($imap_stream, $lsub_args,
                                         true, $response, $message);
 
+
         /*
          * Section about removing the last element was removed 
          * We don't return "* OK" anymore from sqimap_read_data