6.0.0-git
2020-08-13

Diff for CyrusHierarchical between 1 and 2



**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
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>

Patch against Horde 3.1 and IMP 4.1:

<code>
diff -urN horde-org/imp/config/conf.xml horde/imp/config/conf.xml
--- horde-org/imp/config/conf.xml	2006-01-14 17:52:34.000000000 +0100
+++ horde/imp/config/conf.xml	2006-03-23 09:35:37.000000000 +0100
@@ -126,6 +126,8 @@
    session size (approx. 100 - 200 KB 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>
 
diff -urN horde-org/imp/lib/IMAP/Tree.php horde/imp/lib/IMAP/Tree.php
--- horde-org/imp/lib/IMAP/Tree.php	2006-02-09 06:51:12.000000000 +0100
+++ horde/imp/lib/IMAP/Tree.php	2006-03-23 09:35:37.000000000 +0100
@@ -77,7 +77,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']);
diff -urN horde-org/lib/Horde/IMAP/Tree.php horde/lib/Horde/IMAP/Tree.php
--- horde-org/lib/Horde/IMAP/Tree.php	2006-03-06 18:15:16.000000000 +0100
+++ horde/lib/Horde/IMAP/Tree.php	2006-03-23 09:35:37.000000000 +0100
@@ -408,6 +408,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')) {
@@ -418,6 +420,7 @@
                     $elt['p'] = 'INBOX';
                 }
             }
+            }
         }
         $elt['l'] = String::convertCharset($tmp[$label], 'UTF7-IMAP');
 
</code>