From 02491a9789d97fc321a3027847fd4ced42447cc6 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 17 Dec 2010 04:16:47 -0500
Subject: [PATCH] - Make possible to overwrite server's namespaces with imap_ns_* options

---
 program/include/rcube_addressbook.php |   66 +++++++++++++++++++++-----------
 1 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/program/include/rcube_addressbook.php b/program/include/rcube_addressbook.php
index 3b07235..8b621f6 100644
--- a/program/include/rcube_addressbook.php
+++ b/program/include/rcube_addressbook.php
@@ -64,13 +64,6 @@
     abstract function list_records($cols=null, $subset=0);
 
     /**
-     * List all active contact groups of this source
-     *
-     * @return array  Indexed list of contact groups, each a hash array
-     */
-    function list_groups() { }
-
-    /**
      * Search records
      *
      * @param array   List of fields to search in
@@ -83,14 +76,14 @@
     /**
      * Count number of available contacts in database
      *
-     * @return object rcube_result_set Result set with values for 'count' and 'first'
+     * @return rcube_result_set Result set with values for 'count' and 'first'
      */
     abstract function count();
 
     /**
      * Return the last result set
      *
-     * @return object rcube_result_set Current result set or NULL if nothing selected yet
+     * @return rcube_result_set Current result set or NULL if nothing selected yet
      */
     abstract function get_result();
 
@@ -99,6 +92,7 @@
      *
      * @param mixed record identifier(s)
      * @param boolean True to return record as associative array, otherwise a result set is returned
+     *
      * @return mixed Result object with all record fields or False if not found
      */
     abstract function get_record($id, $assoc=false);
@@ -132,17 +126,11 @@
     }
 
     /**
-     * Setter for the current group
-     * (empty, has to be re-implemented by extending class)
-     */
-    function set_group($gid) { }
-
-    /**
      * Create a new contact record
      *
      * @param array Assoziative array with save data
      * @param boolean True to check for duplicates first
-     * @return The created record ID on success, False on error
+     * @return mixed The created record ID on success, False on error
      */
     function insert($save_data, $check=false)
     {
@@ -154,7 +142,7 @@
      *
      * @param mixed Record identifier
      * @param array Assoziative array with save data
-     * @return True on success, False on error
+     * @return boolean True on success, False on error
      */
     function update($id, $save_cols)
     {
@@ -180,17 +168,34 @@
     }
 
     /**
+     * Setter for the current group
+     * (empty, has to be re-implemented by extending class)
+     */
+    function set_group($gid) { }
+
+    /**
+     * List all active contact groups of this source
+     *
+     * @return array  Indexed list of contact groups, each a hash array
+     */
+    function list_groups()
+    {
+        /* empty for address books don't supporting groups */
+        return array();
+    }
+
+    /**
      * Create a contact group with the given name
      *
      * @param string The group name
-     * @return False on error, array with record props in success
+     * @return mixed False on error, array with record props in success
      */
     function create_group($name)
     {
         /* empty for address books don't supporting groups */
         return false;
     }
-    
+
     /**
      * Delete the given group and all linked group members
      *
@@ -202,7 +207,7 @@
         /* empty for address books don't supporting groups */
         return false;
     }
-    
+
     /**
      * Rename a specific contact group
      *
@@ -215,20 +220,20 @@
         /* empty for address books don't supporting groups */
         return false;
     }
-    
+
     /**
      * Add the given contact records the a certain group
      *
      * @param string  Group identifier
      * @param array   List of contact identifiers to be added
-     * @return int    Number of contacts added 
+     * @return int    Number of contacts added
      */
     function add_to_group($group_id, $ids)
     {
         /* empty for address books don't supporting groups */
         return 0;
     }
-    
+
     /**
      * Remove the given contact records from a certain group
      *
@@ -241,4 +246,19 @@
         /* empty for address books don't supporting groups */
         return 0;
     }
+
+    /**
+     * Get group assignments of a specific contact record
+     *
+     * @param mixed Record identifier
+     *
+     * @return array List of assigned groups as ID=>Name pairs
+     * @since 0.5-beta
+     */
+    function get_record_groups($id)
+    {
+        /* empty for address books don't supporting groups */
+        return array();
+    }
 }
+

--
Gitblit v1.9.1