From a5a4bf46bd2e579e828989563c120f9ab2b28a32 Mon Sep 17 00:00:00 2001 From: alecpl Date: Mon, 25 Oct 2010 12:39:36 +0000 Subject: - Add basic IMAP LIST's \Noselect option support (mark unselectable folders as virtual, etc.) --- program/include/rcube_imap_generic.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'program/include/rcube_imap_generic.php') 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 () 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 () else if ($cmd == 'STATUS') { -- cgit v1.2.3