diff options
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/main.inc | 8 | ||||
-rw-r--r-- | program/include/rcube_imap.php | 25 | ||||
-rw-r--r-- | program/include/rcube_imap_generic.php | 15 |
3 files changed, 46 insertions, 2 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index 46e45f7cb..7e96233bc 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -1332,6 +1332,8 @@ function rcmail_mailbox_select($p = array()) */ function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='') { + global $RCMAIL; + $pos = strpos($folder, $delm); if ($pos !== false) { @@ -1354,6 +1356,12 @@ function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='') $path .= $currentFolder; + // Check \Noselect option + if (!$virtual) { + $opts = $RCMAIL->imap->mailbox_options($path); + $virtual = in_array('\\Noselect', $opts); + } + if (!isset($arrFolders[$currentFolder])) { $arrFolders[$currentFolder] = array( 'id' => $path, diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 7fbff37f1..46427d6cf 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -3121,6 +3121,31 @@ class rcube_imap /** + * Gets folder options from LIST/LSUB response, e.g. \Noselect, \Noinferiors + * + * @param string $mbox_name Folder name + * + * @return array Options list + */ + function mailbox_options($mbox_name) + { + $mbox = $this->mod_mailbox($mbox_name); + + if ($mbox == 'INBOX') { + return array(); + } + + if (!is_array($this->conn->data['LIST']) || !is_array($this->conn->data['LIST'][$mbox])) { + $this->conn->listMailboxes($this->mod_mailbox(''), $mbox_name); + } + + $opts = $this->conn->data['LIST'][$mbox]; + + return is_array($opts) ? $opts : array(); + } + + + /** * Get message header names for rcube_imap_generic::fetchHeader(s) * * @return string Space-separated list of header names diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php index 9009d125d..d51b8cfbe 100644 --- a/program/include/rcube_imap_generic.php +++ b/program/include/rcube_imap_generic.php @@ -857,6 +857,12 @@ class rcube_imap_generic return true; } + if (is_array($this->data['LIST']) && is_array($opts = $this->data['LIST'][$mailbox])) { + if (in_array('\\Noselect', $opts)) { + return false; + } + } + list($code, $response) = $this->execute('SELECT', array($this->escape($mailbox))); if ($code == self::ERROR_OK) { @@ -1861,11 +1867,11 @@ class rcube_imap_generic if (empty($mailbox)) { $mailbox = '*'; } -/* + if (empty($ref) && $this->prefs['rootdir']) { $ref = $this->prefs['rootdir']; } -*/ + $args = array($this->escape($ref), $this->escape($mailbox)); if (!empty($status_opts) && $this->getCapability('LIST-STATUS')) { @@ -1884,12 +1890,17 @@ class rcube_imap_generic // * LIST (<options>) <delimiter> <mailbox> if (!$lstatus || $cmd == 'LIST' || $cmd == 'LSUB') { list($opts, $delim, $folder) = $this->tokenizeResponse($response, 3); + if (!$lstatus) { $folders[] = $folder; } else { $folders[$folder] = array(); } + + if ($cmd == 'LIST') { + $this->data['LIST'][$folder] = $opts; + } } // * STATUS <mailbox> (<result>) else if ($cmd == 'STATUS') { |