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, $noselect_fix_enable, $imap_server_type;
+ $delimiter, $noselect_fix_enable, $imap_server_type,
+ $show_only_subscribed_folders;
$inbox_subscribed = false;
$listsubscribed = sqimap_capability($imap_stream,'LIST-SUBSCRIBED');
require_once(SM_PATH . 'include/load_prefs.php');
-
- if ($listsubscribed) {
+ if (!$show_only_subscribed_folders) {
+ $lsub = 'LIST';
+ } elseif ($listsubscribed) {
$lsub = 'LIST (SUBSCRIBED)';
} else {
$lsub = 'LSUB';
}
if ($noselect_fix_enable) {
-
$lsub_args = "$lsub \"$folder_prefix\" \"*%\"";
} else {
$lsub_args = "$lsub \"$folder_prefix\" \"*\"";
if (true) {
global $data_dir, $username, $list_special_folders_first,
$folder_prefix, $delimiter, $trash_folder, $move_to_trash,
- $imap_server_type;
+ $imap_server_type, $show_only_subscribed_folders;
$noselect = false;
$noinferiors = false;
require_once(SM_PATH . 'include/load_prefs.php');
+ if ($show_only_subscribed_folders) {
+ $lsub_cmd = 'LSUB';
+ } else {
+ $lsub_cmd = 'LIST';
+ }
+
/* LSUB array */
- $lsub_ary = sqimap_run_command ($imap_stream, "LSUB \"$folder_prefix\" \"*\"",
+ $lsub_ary = sqimap_run_command ($imap_stream, "$lsub_cmd \"$folder_prefix\" \"*\"",
true, $response, $message);
$lsub_ary = compact_mailboxes_response($lsub_ary);
$has_inbox = false;
for ($i = 0, $cnt = count($lsub_ary); $i < $cnt; $i++) {
- if (preg_match("/^\*\s+LSUB.*\s\"?INBOX\"?[^(\/\.)].*$/i",$lsub_ary[$i])) {
+ if (preg_match("/^\*\s+$lsub_cmd.*\s\"?INBOX\"?[^(\/\.)].*$/i",$lsub_ary[$i])) {
$lsub_ary[$i] = strtoupper($lsub_ary[$i]);
// in case of an unsubscribed inbox an imap server can
// return the inbox in the lsub results with a \NoSelect
// flag.
- if (!preg_match("/\*\s+LSUB\s+\(.*\\\\NoSelect.*\).*/i",$lsub_ary[$i])) {
+ if (!preg_match("/\*\s+$lsub_cmd\s+\(.*\\\\NoSelect.*\).*/i",$lsub_ary[$i])) {
$has_inbox = true;
} else {
// remove the result and request it again with a list
if ($has_inbox == false) {
// do a list request for inbox because we should always show
// inbox even if the user isn't subscribed to it.
- $inbox_ary = sqimap_run_command ($imap_stream, 'LIST "" INBOX',
+ $inbox_ary = sqimap_run_command ($imap_stream, 'LIST "" "INBOX"',
true, $response, $message);
$inbox_ary = compact_mailboxes_response($inbox_ary);
if (count($inbox_ary)) {
}
}
-?>
\ No newline at end of file
+?>