Aleksander Machniak
2012-07-24 0afe27901189a5416dc696eef32e2bc2e5fe3844
program/include/rcube_imap_generic.php
@@ -5,8 +5,8 @@
 | program/include/rcube_imap_generic.php                                |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2010, The Roundcube Dev Team                       |
 | Copyright (C) 2011, Kolab Systems AG                                  |
 | Copyright (C) 2005-2012, The Roundcube Dev Team                       |
 | Copyright (C) 2011-2012, Kolab Systems AG                             |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -24,13 +24,7 @@
 | Author: Aleksander Machniak <alec@alec.pl>                            |
 | Author: Ryo Chijiiwa <Ryo@IlohaMail.org>                              |
 +-----------------------------------------------------------------------+
 $Id$
*/
// for backward copat.
class rcube_mail_header extends rcube_message_header { }
/**
@@ -1478,14 +1472,31 @@
     */
    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);
@@ -1493,7 +1504,9 @@
            $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;
@@ -1611,7 +1624,7 @@
        // If ESEARCH is supported always use ALL
        // but not when items are specified or using simple id2uid search
        if (empty($items) && ((int) $criteria != $criteria)) {
        if (empty($items) && preg_match('/[^0-9]/', $criteria)) {
            $items = array('ALL');
        }