6.0.0-git
2024-04-19

Diff for CyrusHierarchical between and 1


**IMP (4.1+) Hierarchical folder structure with Cyrus IMAP**



Since IMP 4.1+ the previous hierarchical folder structure - personal folders below INBOX, shared folders beside INBOX - has gone, because it is not the correct way - according to the RFCs.

This has been discussed in [http://bugs.horde.org/ticket/?id=3004 Ticket #3004] and [http://bugs.horde.org/ticket/?id=2422 Ticket #2422].



Because some people still would like to have the folders presented the old way, here are patches to enable this - still working with HEAD from 16. March 2006.



I am not familiar with php and making patch-files - every suggestion would help.



A configuration option - ['server']['dont_strip_namespace'] - will be added to imp/conf.xml (update your IMP configuration after patching !), imp/lib/IMAP/Tree.php and framework/IMAP/IMAP/Tree.php (bring installed framework up-to-date after patching !) will be patched.



##red|Use this at your own risk !##

it is working fine for me with Cyrus 2.3.3, PHP 4.4.2, Apache 1.3.34 and Horde HEAD



----



<code>

--- imp/lib/IMAP/Tree.php	2005-11-18 18:43:47.000000000 +0100

+++ imp/lib/IMAP/Tree.php	2005-11-22 20:10:52.260870192 +0100

@@ -68,7 +68,8 @@

         if ($imp['base_protocol'] != 'pop3') {

             $ptr = reset($_SESSION['imp']['namespace']);

             $this->_delimiter = $ptr['delimiter'];

-            if (method_exists($this, 'extendedNamespaceSupport')) {

+            global $conf;

+            if (method_exists($this, 'extendedNamespaceSupport') && !$conf['server']['dont_strip_namespace']) {

                 $this->_newimaptree = true;

                 $this->_namespaces = $_SESSION['imp']['namespace'];

                 $this->IMAPchildrenSupport($_SESSION['imp']['imap_server']['children']);







--- framework/IMAP/IMAP/Tree.php	2005-11-18 18:44:46.000000000 +0100

+++ framework/IMAP/IMAP/Tree.php	2005-11-22 21:34:26.770548848 +0100

@@ -409,6 +409,8 @@

             !preg_match("/\{.*pop3.*\}/", $ob->fullServerPath)) {

             $elt['p'] = implode((is_null($ns_info)) ? $this->_delimiter : $ns_info['delimiter'], array_slice($tmp, 0, $elt['c']));

             /* Strip personal namespace. */

+            global $conf;

+            if (!$conf['server']['dont_strip_namespace']) {

             if (!is_null($ns_info) &&

                 !empty($ns_info['name']) &&

                 ($ns_info['type'] == 'personal')) {

@@ -419,6 +421,7 @@

                     $elt['p'] = 'INBOX';

                 }

             }

+            }

         }

         $elt['l'] = String::convertCharset($tmp[$label], 'UTF7-IMAP');







--- imp/config/conf.xml	2005-11-18 18:43:47.000000000 +0100

+++ imp/config/conf.xml	2005-11-19 12:18:09.815006816 +0100

@@ -125,6 +125,8 @@

    significantly higher session size (5 MB+ per user) so make sure your

    session backend can handle the increased storage demands.">

    false</configboolean>

+   <configboolean name="dont_strip_namespace" desc="If you would like to have

+   a hierarchical listing of the folders, you should enable this checkbox.">false</configboolean>

   </configsection>

  </configtab>

</code>