<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>Folder dropdown sorted incorrectly</title> 
  <pubDate>Fri, 10 Apr 2026 09:35:36 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/1291</link> 
  <atom:link rel="self" type="application/rss+xml" title="Folder dropdown sorted incorrectly" href="https://bugs.horde.org/ticket/1291/rss" /> 
  <description>Folder dropdown sorted incorrectly</description> 
 
   
   
  <item> 
   <title>I&#039;ve first noticed this bug with IMP 2.2, and later confirme</title> 
   <description>I&#039;ve first noticed this bug with IMP 2.2, and later confirmed that it is still present in the current version of IMP, 4.0.1.



On my testing Cyrus IMAPD server, I created following mailbox structure on the Cyrus IMAPD server for testing shared mailboxes (as printed by cyradm&#039;s listmailbox command):



bureq (\HasNoChildren)

shared.foobar (\HasNoChildren)

user.amilivojevic (\HasChildren)

user.amilivojevic.Drafts (\HasNoChildren)

user.amilivojevic.Sent Items (\HasNoChildren)

user.amilivojevic.Spam (\HasNoChildren)

user.amilivojevic.Templates (\HasNoChildren)

user.foobar (\HasChildren)

user.foobar.shared (\HasNoChildren)

user.foobar.shared-to-all (\HasNoChildren)

user.user2 (\HasChildren)

user.user2.shr (\HasNoChildren)



user.amilivojevic is my INBOX folder.  bureq and shared.* folders are, well, shared folders.  Some of the other user&#039;s folders inside user are also shared (folders with names ending with shared, shared-to-all, and shr).



The alternate namespace on Cyrus IMAPD is turned off.  In IMP&#039;s servers.php, folders and namespace are set to empty strings (I do want users to see folders as subfolders of INBOX, since that is the way their &quot;normal&quot; mail clients are set up).



There were two problems with folder dropdown list.  The first one seems to be solved in current version (user top-level folder was not displayed).



The second problem is still present.  The sorting is incorrect.  Dropdown box looks like this:



INBOX

bureq

   Drafts

   Sent Items

   Spam

   Templates

shared.

   foobar

user.

   foobar.

      shared

      shared-to-all

   user2.

      shr



Clearly, this is not correct display.  Subfolders of INBOX are displayed as if they were subfolders of top-level &quot;bureq&quot; folder.



If I expand the list of folders on the left pane, than I get correct sorting and indentation.  The bug seems to be present only in the dropdown box that is located in the upper right corner of the page.



BTW, would it be possible to have non-selectable mailboxes rendered in different style (in left pane) and non-selectable in dropdown box?  For example, top-level user and shared, as well as user.foobar and user.user2 are not selectable when I&#039;m connected to Cyrus IMAPD as amilivojevic (for example, Mozilla Thunderbird renders those folders in grey, not allowing me to select them).</description> 
   <pubDate>Tue, 01 Feb 2005 18:15:16 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/1291#t5095</link> 
  </item> 
   
  <item> 
   <title>I&#039;ve just found that the bug is also present in every other </title> 
   <description>I&#039;ve just found that the bug is also present in every other dropdown box that contains folder listing.  Example would be dropdown boxes used in Server and Folder Information preferences dialogs.  I guess same code is used to generate those dropdown boxes.</description> 
   <pubDate>Tue, 01 Feb 2005 20:05:50 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/1291#t5109</link> 
  </item> 
   
  <item> 
   <title>The bug is in _mbox_cmp function in horde-3.0.2/lib/Horde/IM</title> 
   <description>The bug is in _mbox_cmp function in horde-3.0.2/lib/Horde/IMAP/Sort.php.  When sorting, it checks only if one of the arguments is INBOX itself.  Folders that are subfolders of INBOX are sorted just like any other folders (ignoring _sortinbox setting).



The attached patch fixes this.  Even when using namespace or similar options, this should be good thing to do.  Sorted list will contain INBOX, than subfolders of INBOX (with INBOX. part displayed or hidden, depending on used options), and than all other folders.  In some cases, this might result in the folder list that might not look completely sorted on the first look, but it will be more logical (because user&#039;s folders will not be mixed with shared or other users folders).</description> 
   <pubDate>Thu, 03 Feb 2005 18:17:07 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/1291#t5179</link> 
  </item> 
   
  <item> 
   <title>Can you try what I committed to HEAD?

http://cvs.horde.org/</title> 
   <description>Can you try what I committed to HEAD?

http://cvs.horde.org/diff.php/framework/IMAP/IMAP/Sort.php?r1=1.7&amp;r2=1.8&amp;ty=u



It is similar to what you proposed with several enhancements. 1) it is more efficient as the INBOX folder searching code is not evauated on every function call, and 2) it correctly searches for the case-insensitive inbox string instead of exclusively for &#039;INBOX&#039;.



If this works for you, I will commit to Horde 3.0.3.</description> 
   <pubDate>Fri, 04 Feb 2005 06:55:16 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/1291#t5193</link> 
  </item> 
   
  <item> 
   <title>I agree with 2 (although, not sure if RFC says that INBOX is</title> 
   <description>I agree with 2 (although, not sure if RFC says that INBOX is always uppercase, if it is the case, than string comparation should be case sensitive for both this check and the previously existing check for INBOX folder itself at the beggining of fucntion).



As for 1 (speed improvement), it is dependent on IMAP server used, and the way user organized his folders.  On Cyrus with alternate_namespace turned off, I clearly see the benefit and performance improvement.  On everything else, hm, it&#039;s doubtfull.  If alternate_namespace is turned on, and user has a flat folder structure (for example, only top-level folders: INBOX, Folder1, Folder2, and so on), it will be actually slower.  In that case you only introduced one additional if($this-&gt;_sortinbox &amp;&amp; ($i == 0)) check, case that is already checked at the beggining of function.



Anyhow, your patch worked for me.  If you commit it, maybe replace [$i] with [0].  $i is always zero in that part of code (because of &quot;if&quot; statement).  Or using full folder name instead of array component (like in my patch, is there case insensitive version of strpos?).</description> 
   <pubDate>Fri, 04 Feb 2005 16:48:18 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/1291#t5209</link> 
  </item> 
   
  <item> 
   <title>Merged to Horde 3.0.3.



(As for #2, there are several case</title> 
   <description>Merged to Horde 3.0.3.



(As for #2, there are several cases that your patch will do unneeded comparisions while the committed code won&#039;t - for example, consider the comparision of two mailboxes &#039;INBOX.foo1&#039; and &#039;INBOX.foo2&#039; )</description> 
   <pubDate>Mon, 07 Feb 2005 19:59:39 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/1291#t5283</link> 
  </item> 
   
  <item> 
   <title>Thank you for resolving this bug.</title> 
   <description>Thank you for resolving this bug.</description> 
   <pubDate>Tue, 08 Feb 2005 01:29:29 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/1291#t5287</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
