summaryrefslogtreecommitdiff
path: root/program/include/rcube_imap_generic.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-06-28 09:22:31 +0200
committerAleksander Machniak <alec@alec.pl>2012-06-28 09:22:31 +0200
commit669747a81c4b2ff823d1f20dc50899163c0a8a4a (patch)
tree13d820f775fe4db054b26f616b802caa8fef23e6 /program/include/rcube_imap_generic.php
parentceaaebbc8c99711e143673d845d029a362bc848e (diff)
parentacf5becbf16675f43882cc5cd485462041c7b0af (diff)
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'program/include/rcube_imap_generic.php')
-rw-r--r--program/include/rcube_imap_generic.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index 959dd9fd0..197164dfe 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -1472,14 +1472,31 @@ class rcube_imap_generic
*/
function enable($extension)
{
- if (empty($extension))
+ if (empty($extension)) {
return false;
+ }
- if (!$this->hasCapability('ENABLE'))
+ if (!$this->hasCapability('ENABLE')) {
return false;
+ }
- if (!is_array($extension))
+ if (!is_array($extension)) {
$extension = array($extension);
+ }
+
+ if (!empty($this->extensions_enabled)) {
+ // check if all extensions are already enabled
+ $diff = array_diff($extension, $this->extensions_enabled);
+
+ if (empty($diff)) {
+ return $extension;
+ }
+
+ // Make sure the mailbox isn't selected, before enabling extension(s)
+ if ($this->selected !== null) {
+ $this->close();
+ }
+ }
list($code, $response) = $this->execute('ENABLE', $extension);
@@ -1487,7 +1504,9 @@ class rcube_imap_generic
$response = substr($response, 10); // remove prefix "* ENABLED "
$result = (array) $this->tokenizeResponse($response);
- return $result;
+ $this->extensions_enabled = array_unique(array_merge((array)$this->extensions_enabled, $result));
+
+ return $this->extensions_enabled;
}
return false;