\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\textbf{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.<br />
This has been discussed in <a href="http://bugs.horde.org/ticket/?id=3004">Ticket \#3004</a> and <a href="http://bugs.horde.org/ticket/?id=2422">Ticket \#2422</a>.

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.

Use this at your own risk !<br />
it is working fine for me with Cyrus 2.3.3, PHP 4.4.2, Apache 1.3.34 and Horde HEAD


\noindent\rule{\textwidth}{1pt}
<pre><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("/\textbackslash\{\}\{.*pop3.*\textbackslash\{\}\}/", \$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></pre>
Patch against Horde 3.1 and IMP 4.1:

<pre><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("/\textbackslash\{\}\{.*pop3.*\textbackslash\{\}\}/", \$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></pre>
\end{document}
