From ca85aabeaed107e6b7297c9f762428301d28839b Mon Sep 17 00:00:00 2001 From: jmunro Date: Tue, 11 Jun 2002 14:52:54 +0000 Subject: [PATCH] this is a fix for the LSUB with a % when getting the folder list. This makes the % argument an option in conf.pl, menu 3 option 18. The default is to not use the "%". See patch #452178 for more info. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2944 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- config/conf.pl | 29 +++++++++++++++++++++++++++++ config/config_default.php | 9 +++++++++ functions/imap_mailbox.php | 11 +++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/config/conf.pl b/config/conf.pl index 7802bcfa..87534d77 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -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 = ; + 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 diff --git a/config/config_default.php b/config/config_default.php index b4aceb6b..656c9ddf 100644 --- a/config/config_default.php +++ b/config/config_default.php @@ -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). diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 5594e78f..53a586d2 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -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 -- 2.25.1