﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
1485703,Fix large search results in non-default_imap_folders when imap_root is set,mbac,,"When imap_root is set, searching a large result set in a folder other than default_imap_folders generates multiple calls to _mod_mailbox() which creates an invalid mailbox name. 

For instance, if imap_root is ""INBOX."", the following IMAP protocol event may occur:


{{{
[26-Jan-2009 13:32:17 -0500]: C: sel1 SELECT ""INBOX.INBOX.test""
[26-Jan-2009 13:32:17 -0500]: S: sel1 NO Mailbox does not exist, or must be subscribed to.
}}}

which causes the search to fail.

Since the fully qualified current mailbox name is available to message_index by way of $this->mailbox, this patch merely instructs the function to use that.

{{{
diff -u rcube_imap.php.old rcube_imap.php
--- rcube_imap.php.old  2009-01-26 13:47:29.000000000 -0500
+++ rcube_imap.php      2009-01-26 13:49:26.000000000 -0500
@@ -685,7 +685,7 @@
       $cnt = count($msgs);
       if ($cnt > 300 && $cnt > $this->page_size) { // experimantal value for best result
         // use memory less expensive (and quick) method for big result set
-       $a_index = $this->message_index($mailbox, $this->sort_field, $this->sort_order);
+       $a_index = $this->message_index('', $this->sort_field, $this->sort_order);
         // get messages uids for one page...
         $msgs = array_slice($a_index, $start_msg, min($cnt-$start_msg, $this->page_size));
        // ...and fetch headers

}}}
",Feature Patches,closed,5,0.2.1,IMAP connection,git-master,normal,fixed,imap search large result set,
