gunnar: server/horde/horde-framework HK-GW-Kolab_issue_2138.patch, NONE, 1.1 ChangeLog, 1.8, 1.9 horde-framework-kolab.spec, 1.26, 1.27

cvs at kolab.org cvs at kolab.org
Mon Nov 19 20:41:03 CET 2007


Author: gunnar

Update of /kolabrepository/server/horde/horde-framework
In directory doto:/tmp/cvs-serv6074/horde-framework

Modified Files:
	ChangeLog horde-framework-kolab.spec 
Added Files:
	HK-GW-Kolab_issue_2138.patch 
Log Message:
kolab/issue2138

--- NEW FILE: HK-GW-Kolab_issue_2138.patch ---
Fix kolab issue 2138.

diff -r 794fd76385d6 framework/Kolab/Kolab/IMAP.php
--- a/framework/Kolab/Kolab/IMAP.php	Mon Nov 19 14:52:25 2007 +0100
+++ b/framework/Kolab/Kolab/IMAP.php	Mon Nov 19 14:57:56 2007 +0100
@@ -289,7 +289,11 @@ class Kolab_IMAP {
         $this->_object_type = $app_consts['mime_type_suffix'];
         $this->_mime_type = KOLAB_MIME_TYPE_PREFIX . $this->_object_type;
         $this->_owner = Auth::getAuth();
-        $this->_folder = $this->parseFolder($share_uid);
+        $folder = $this->parseFolder($share_uid);
+        if (is_a($folder, 'PEAR_Error')) {
+            return $folder;
+        }
+        $this->_folder = $folder;
 
         $this->_imap = &Kolab_IMAP_Connection::singleton(Kolab::getServer('imap'),
                                                          $conf['kolab']['imap']['port'], true, false);
@@ -358,8 +362,9 @@ class Kolab_IMAP {
                     return $folder[0];
                 }
             }
-        }
-	return rawurldecode($folder);
+            return PEAR::raiseError(sprintf(_("Default folder of type %s does not exist!"), $this->_object_type));
+        }
+        return rawurldecode($folder);
     }
 
     /**
@@ -371,70 +376,11 @@ class Kolab_IMAP {
      */
     function listFolders()
     {
-        require_once 'Horde/SessionObjects.php';
-
-        static $folders = array();
-
-        if (empty($folders)) {
-            $session = &Horde_SessionObjects::singleton();
-            $folders = &$session->query('horde_kolab_imaplist');
-        }
-
-        if (!empty($folders)) {
-            return $folders;
-        }
-
         // Connect to the IMAP server
         $imap = &Kolab_IMAP_Connection::singleton(Kolab::getServer('imap'),
                                                   $GLOBALS['conf']['kolab']['imap']['port']);
 
-        // Login using the current Horde credentials
-        $result = $imap->connect(Auth::getAuth(),
-                                 Auth::getCredential('password'));
-        if (is_a($result, 'PEAR_Error')) {
-            Horde::logMessage('Unable to authenticate with the Kolab IMAP server', __FILE__, __LINE__, PEAR_LOG_ERR);
-            $imap->disconnect();
-            return $folders;
-        }
-
-        // Obtain a list of all folders the current user has access to
-        $folder_list = $imap->getMailboxes();
-        if (is_a($folder_list, 'PEAR_Error')) {
-            Horde::logMessage('Unable to obtain IMAP folder list', __FILE__, __LINE__, PEAR_LOG_ERR);
-            $imap->disconnect();
-            return $folders;
-        }
-
-        // Iterate over all the folders obtaining their groupware types
-        foreach ($folder_list as $folder) {
-            $foldertype = 'mail';
-            $default = false;
-
-            $annotation = $imap->getAnnotation(KOLAB_ANNOT_FOLDER_TYPE,
-                                               'value.shared',
-                                               $folder);
-            if (!is_a($annotation, 'PEAR_Error') && !empty($annotation)) {
-                $type = explode('.', $annotation);
-                if ((!empty($type[1]) && $type[1] == 'default') ||
-                    (empty($type[1]))) {
-                    $foldertype = $type[0];
-                    if (!empty($type[1]) && $type[1] == 'default') {
-                        $default = true;
-                    } else {
-                        $default = false;
-                    }
-                }
-            }
-
-            $folders[] = array($folder, $foldertype, $default);
-        }
-
-        $session = &Horde_SessionObjects::singleton();
-        $session->overwrite('horde_kolab_imaplist', $folders, false);
-
-        $imap->disconnect();
-
-        return $folders;
+        return $imap->listFolders();
     }
 
     /**
@@ -662,6 +608,9 @@ class Kolab_IMAP {
         // This assumes that both folders are owned by $this->_owner.
         // This needs to be checked.
         $new_folder = $this->parseFolder($new_folder);
+        if (is_a($new_folder, 'PEAR_Error')) {
+            return $new_folder;
+        }
 
         $result = $this->_imap->moveMessage($imap_uid, $new_folder);
         if (is_a($result, 'PEAR_Error')) {
@@ -1371,6 +1320,9 @@ class Kolab_IMAP {
 
         $new_share = rawurldecode($new_share);
         $new_share = $this->parseFolder($new_share);
+        if (is_a($new_share, 'PEAR_Error')) {
+            return $new_share;
+        }
 
         $msg_no = $this->findObject($uid);
         if (is_a($msg_no, 'PEAR_Error')) {
@@ -1713,4 +1665,83 @@ class Kolab_IMAP_Connection {
 
         return $driver;
     }
+
+    /**
+     * Returns a list of all IMAP folders (including their groupware type)
+     * that the current user has acccess to.
+     *
+     * @return array  An array of array($foldername, $foldertype) items (empty
+     *                on error).
+     */
+    function listFolders()
+    {
+        require_once 'Horde/SessionObjects.php';
+
+        static $folders = array();
+
+        if (empty($folders)) {
+            $session = &Horde_SessionObjects::singleton();
+            $folders = &$session->query('horde_kolab_imaplist');
+        }
+
+        if (!empty($folders)) {
+            return $folders;
+        }
+
+        // Login using the current Horde credentials
+        $result = $this->connect(Auth::getAuth(),
+                                 Auth::getCredential('password'));
+        if (is_a($result, 'PEAR_Error')) {
+            Horde::logMessage('Unable to authenticate with the Kolab IMAP server', __FILE__, __LINE__, PEAR_LOG_ERR);
+            return $folders;
+        }
+
+        // Obtain a list of all folders the current user has access to
+        $folder_list = $this->getMailboxes();
+        if (is_a($folder_list, 'PEAR_Error')) {
+            Horde::logMessage('Unable to obtain IMAP folder list', __FILE__, __LINE__, PEAR_LOG_ERR);
+            return $folders;
+        }
+
+        // Iterate over all the folders obtaining their groupware types
+        foreach ($folder_list as $folder) {
+            $foldertype = 'mail';
+            $default = false;
+            $subtype = '';
+
+            $annotation = $this->getAnnotation(KOLAB_ANNOT_FOLDER_TYPE,
+                                               'value.shared',
+                                               $folder);
+            if (!is_a($annotation, 'PEAR_Error') && !empty($annotation)) {
+                $type = explode('.', $annotation);
+                if (!empty($type[0])) {
+                    $foldertype = $type[0];
+                    if (!empty($type[1])) {
+                        $subtype = $type[1];
+                        if ($type[1] == 'default') {
+                            $default = true;
+                        }
+                    }
+                }
+            }
+
+            $folders[] = array($folder, $foldertype, $default, $subtype);
+        }
+
+        $session = &Horde_SessionObjects::singleton();
+        $session->overwrite('horde_kolab_imaplist', $folders, false);
+
+        return $folders;
+    }
+
+    /**
+     * Resets the list cache
+     */
+    function resetListCache()
+    {
+        require_once 'Horde/SessionObjects.php';
+        $session = &Horde_SessionObjects::singleton();
+        $session->overwrite('horde_kolab_imaplist', false, false);
+    }
+
 }
diff -r 794fd76385d6 framework/Kolab/Kolab/IMAP/cclient.php
--- a/framework/Kolab/Kolab/IMAP/cclient.php	Mon Nov 19 14:52:25 2007 +0100
+++ b/framework/Kolab/Kolab/IMAP/cclient.php	Mon Nov 19 14:57:56 2007 +0100
@@ -163,6 +163,8 @@ class Kolab_IMAP_Connection_cclient exte
      */
     function create($folder)
     {
+        $this->resetListCache();
+        
         $mbox = $this->_base_mbox . $folder;
         $result = @imap_createmailbox($this->_imap, $mbox);
         if (!$result) {
@@ -181,6 +183,8 @@ class Kolab_IMAP_Connection_cclient exte
      */
     function delete($folder)
     {
+        $this->resetListCache();
+
         $mbox = $this->_base_mbox . $folder;
         $result = @imap_deletemailbox($this->_imap, $mbox);
         if (!$result) {
@@ -200,6 +204,8 @@ class Kolab_IMAP_Connection_cclient exte
      */
     function rename($old, $new)
     {
+        $this->resetListCache();
+
         $result = @imap_renamemailbox($this->_imap,
                                       $this->_base_mbox . $old,
                                       $this->_base_mbox . $new);
@@ -391,18 +397,20 @@ class Kolab_IMAP_Connection_cclient exte
      */
     function getMailboxes()
     {
+        $folders = array();
+              
         $result = @imap_list($this->_imap, $this->_base_mbox, '*');
         if (!$result) {
             return PEAR::raiseError(sprintf(_("IMAP error. Folder: %s. Error: %s"), $this->_base_mbox, @imap_last_error()));
         }
-
-        $folders = array();
+              
         $server_len = strlen($this->_base_mbox);
         foreach ($result as $folder) {
             if (substr($folder, 0, $server_len) == $this->_base_mbox) {
                 $folders[] = substr($folder, $server_len);
             }
         }
+        
         return $folders;
     }
 
diff -r 794fd76385d6 framework/Kolab/Kolab/IMAP/pear.php
--- a/framework/Kolab/Kolab/IMAP/pear.php	Mon Nov 19 14:52:25 2007 +0100
+++ b/framework/Kolab/Kolab/IMAP/pear.php	Mon Nov 19 14:57:56 2007 +0100
@@ -107,6 +107,7 @@ class Kolab_IMAP_Connection_pear extends
      */
     function create($folder)
     {
+        $this->resetListCache();
         return $this->_imap->createMailbox($folder);
     }
 
@@ -120,6 +121,7 @@ class Kolab_IMAP_Connection_pear extends
      */
     function delete($folder)
     {
+        $this->resetListCache();
         return $this->_imap->deleteMailbox($folder);
     }
 
@@ -134,6 +136,7 @@ class Kolab_IMAP_Connection_pear extends
      */
     function rename($old, $new)
     {
+        $this->resetListCache();
         return $this->_imap->renameMailbox($old, $new);
     }
 

Index: ChangeLog
===================================================================
RCS file: /kolabrepository/server/horde/horde-framework/ChangeLog,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ChangeLog	8 Nov 2007 11:54:52 -0000	1.8
+++ ChangeLog	19 Nov 2007 19:41:01 -0000	1.9
@@ -1,3 +1,9 @@
+2007-11-19  Gunnar Wrobel  <p at rdus.de>
+
+	* horde-framework-kolab.spec:
+
+	kolab/issue2138 (Horde creates events in main inbox)
+
 2007-11-08  Gunnar Wrobel  <p at rdus.de>
 
 	* horde-framework-kolab.spec:

Index: horde-framework-kolab.spec
===================================================================
RCS file: /kolabrepository/server/horde/horde-framework/horde-framework-kolab.spec,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- horde-framework-kolab.spec	8 Nov 2007 11:54:52 -0000	1.26
+++ horde-framework-kolab.spec	19 Nov 2007 19:41:01 -0000	1.27
@@ -3,7 +3,7 @@
 %define         V_package horde-%{V_horde_name}-kolab
 %define         V_year  2007
 %define         V_month 11
-%define         V_day   01
+%define         V_day   19
 %define         V_version 3.2_ALPHA
 %define         V_date %{V_year}-%{V_month}-%{V_day}
 %define         V_release %{V_year}%{V_month}%{V_day}
@@ -31,6 +31,7 @@
 Patch2:         HK-GW-Fix_annotation_use.patch
 Patch3:         HK-GW-Share_caching.patch
 Patch4:         HK-GW-Kolab_issue_2144.patch
+Patch5:         HK-GW-Kolab_issue_2138.patch
 
 # Build Info
 Prefix:		%{l_prefix}
@@ -57,6 +58,7 @@
 	%patch -p2 -P 2
 	%patch -p2 -P 3
 	%patch -p2 -P 4
+	%patch -p2 -P 5
 
 %build
 





More information about the commits mailing list