From a5a4bf46bd2e579e828989563c120f9ab2b28a32 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 25 Oct 2010 08:39:36 -0400
Subject: [PATCH] - Add basic IMAP LIST's \Noselect option support (mark unselectable folders as virtual, etc.)
---
program/include/rcube_imap_generic.php | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index 9009d12..d51b8cf 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -857,6 +857,12 @@
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 @@
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 @@
// * 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') {
--
Gitblit v1.9.1