From 077cfdac2d979f177489495d6e6524377756f832 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 11 Aug 2011 04:32:04 -0400
Subject: [PATCH] - Added IMAP ENABLE (RFC5161) support - Removed deprecated @access comments

---
 program/include/rcube_imap_generic.php |   64 +++++++++++++++----------------
 1 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index e3c987c..85fb379 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -874,7 +874,6 @@
      * @param string $mailbox Mailbox name
      *
      * @return boolean True on success, false on error
-     * @access public
      */
     function select($mailbox)
     {
@@ -929,7 +928,6 @@
      *                        in RFC3501: UIDNEXT, UIDVALIDITY, RECENT
      *
      * @return array Status item-value hash
-     * @access public
      * @since 0.5-beta
      */
     function status($mailbox, $items=array())
@@ -983,7 +981,6 @@
      * @param string $messages Message UIDs to expunge
      *
      * @return boolean True on success, False on error
-     * @access public
      */
     function expunge($mailbox, $messages=NULL)
     {
@@ -1016,7 +1013,6 @@
      * Executes CLOSE command
      *
      * @return boolean True on success, False on error
-     * @access public
      * @since 0.5
      */
     function close()
@@ -1037,7 +1033,6 @@
      * @param string $mailbox Mailbox name
      *
      * @return boolean True on success, False on error
-     * @access public
      */
     function subscribe($mailbox)
     {
@@ -1053,7 +1048,6 @@
      * @param string $mailbox Mailbox name
      *
      * @return boolean True on success, False on error
-     * @access public
      */
     function unsubscribe($mailbox)
     {
@@ -1069,7 +1063,6 @@
      * @param string $mailbox Mailbox name
      *
      * @return boolean True on success, False on error
-     * @access public
      */
     function deleteFolder($mailbox)
     {
@@ -1085,7 +1078,6 @@
      * @param string $mailbox Mailbox name
      *
      * @return boolean True on success, False on error
-     * @access public
      */
     function clearFolder($mailbox)
     {
@@ -1110,7 +1102,6 @@
      * @param string $mailbox Mailbox name
      *
      * @return int Number of messages, False on error
-     * @access public
      */
     function countMessages($mailbox, $refresh = false)
     {
@@ -1143,7 +1134,6 @@
      * @param string $mailbox Mailbox name
      *
      * @return int Number of messages, False on error
-     * @access public
      */
     function countRecent($mailbox)
     {
@@ -1166,7 +1156,6 @@
      * @param string $mailbox Mailbox name
      *
      * @return int Number of messages, False on error
-     * @access public
      */
     function countUnseen($mailbox)
     {
@@ -1197,7 +1186,6 @@
      * @param array $items Client identification information key/value hash
      *
      * @return array Server identification information key/value hash
-     * @access public
      * @since 0.6
      */
     function id($items=array())
@@ -1222,6 +1210,37 @@
             for ($i=0, $len=count($items); $i<$len; $i += 2) {
                 $result[$items[$i]] = $items[$i+1];
             }
+
+            return $result;
+        }
+
+        return false;
+    }
+
+    /**
+     * Executes ENABLE command (RFC5161)
+     *
+     * @param mixed $extension Extension name to enable (or array of names)
+     *
+     * @return array|bool List of enabled extensions, False on error
+     * @since 0.6
+     */
+    function enable($extension)
+    {
+        if (empty($extension))
+            return false;
+
+        if (!$this->hasCapability('ENABLE'))
+            return false;
+
+        if (!is_array($extension))
+            $extension = array($extension);
+
+        list($code, $response) = $this->execute('ENABLE', $extension);
+
+        if ($code == self::ERROR_OK && preg_match('/\* ENABLED /i', $response)) {
+            $response = substr($response, 10); // remove prefix "* ENABLED "
+            $result   = (array) $this->tokenizeResponse($response);
 
             return $result;
         }
@@ -1466,7 +1485,6 @@
      * @param int    $uid     Message unique identifier (UID)
      *
      * @return int Message sequence identifier
-     * @access public
      */
     function UID2ID($mailbox, $uid)
     {
@@ -1486,7 +1504,6 @@
      * @param int    $uid     Message sequence identifier
      *
      * @return int Message unique identifier
-     * @access public
      */
     function ID2UID($mailbox, $id)
     {
@@ -2110,7 +2127,6 @@
      *
      * @return array List of mailboxes or hash of options if $status_opts argument
      *               is non-empty.
-     * @access public
      */
     function listMailboxes($ref, $mailbox, $status_opts=array(), $select_opts=array())
     {
@@ -2126,7 +2142,6 @@
      *
      * @return array List of mailboxes or hash of options if $status_opts argument
      *               is non-empty.
-     * @access public
      */
     function listSubscribed($ref, $mailbox, $status_opts=array())
     {
@@ -2146,7 +2161,6 @@
      *
      * @return array List of mailboxes or hash of options if $status_ops argument
      *               is non-empty.
-     * @access private
      */
     private function _listMailboxes($ref, $mailbox, $subscribed=false,
         $status_opts=array(), $select_opts=array())
@@ -2654,7 +2668,6 @@
      *
      * @return boolean True on success, False on failure
      *
-     * @access public
      * @since 0.5-beta
      */
     function setACL($mailbox, $user, $acl)
@@ -2678,7 +2691,6 @@
      *
      * @return boolean True on success, False on failure
      *
-     * @access public
      * @since 0.5-beta
      */
     function deleteACL($mailbox, $user)
@@ -2696,7 +2708,6 @@
      * @param string $mailbox Mailbox name
      *
      * @return array User-rights array on success, NULL on error
-     * @access public
      * @since 0.5-beta
      */
     function getACL($mailbox)
@@ -2737,7 +2748,6 @@
      * @param string $user    User name
      *
      * @return array List of user rights
-     * @access public
      * @since 0.5-beta
      */
     function listRights($mailbox, $user)
@@ -2769,7 +2779,6 @@
      * @param string $mailbox Mailbox name
      *
      * @return array MYRIGHTS response on success, NULL on error
-     * @access public
      * @since 0.5-beta
      */
     function myRights($mailbox)
@@ -2796,7 +2805,6 @@
      * @param array  $entries Entry-value array (use NULL value as NIL)
      *
      * @return boolean True on success, False on failure
-     * @access public
      * @since 0.5-beta
      */
     function setMetadata($mailbox, $entries)
@@ -2826,7 +2834,6 @@
      *
      * @return boolean True on success, False on failure
      *
-     * @access public
      * @since 0.5-beta
      */
     function deleteMetadata($mailbox, $entries)
@@ -2856,7 +2863,6 @@
      *
      * @return array GETMETADATA result on success, NULL on error
      *
-     * @access public
      * @since 0.5-beta
      */
     function getMetadata($mailbox, $entries, $options=array())
@@ -2948,7 +2954,6 @@
      *                        three elements: entry name, attribute name, value
      *
      * @return boolean True on success, False on failure
-     * @access public
      * @since 0.5-beta
      */
     function setAnnotation($mailbox, $data)
@@ -2980,7 +2985,6 @@
      *
      * @return boolean True on success, False on failure
      *
-     * @access public
      * @since 0.5-beta
      */
     function deleteAnnotation($mailbox, $data)
@@ -3002,7 +3006,6 @@
      *
      * @return array Annotations result on success, NULL on error
      *
-     * @access public
      * @since 0.5-beta
      */
     function getAnnotation($mailbox, $entries, $attribs)
@@ -3090,7 +3093,6 @@
      * Creates next command identifier (tag)
      *
      * @return string Command identifier
-     * @access public
      * @since 0.5-beta
      */
     function nextTag()
@@ -3109,7 +3111,6 @@
      * @param int    $options   Execution options
      *
      * @return mixed Response code or list of response code and data
-     * @access public
      * @since 0.5-beta
      */
     function execute($command, $arguments=array(), $options=0)
@@ -3167,7 +3168,6 @@
      * @param int    $num  Number of tokens to return
      *
      * @return mixed Tokens array or string if $num=1
-     * @access public
      * @since 0.5-beta
      */
     static function tokenizeResponse(&$str, $num=0)
@@ -3342,7 +3342,6 @@
      *
      * @param   boolean $debug      New value for the debugging flag.
      *
-     * @access  public
      * @since   0.5-stable
      */
     function setDebug($debug, $handler = null)
@@ -3356,7 +3355,6 @@
      *
      * @param   string  $message    Debug mesage text.
      *
-     * @access  private
      * @since   0.5-stable
      */
     private function debug($message)

--
Gitblit v1.9.1