[RCD] Threaded message listing implementation

Chris January chris at atomice.net
Mon Mar 16 18:47:21 CET 2009

On Mon, Mar 16, 2009 at 2:02 PM, Nathan Kinkade <nath at nkinka.de> wrote:
> Sorry, I should have explained some of the changes a little more.  The 2nd
> patch is there because the default behavior of RoundCube is to store any
> sort order you select in both the session and in the database.  With
> X-REFERENCES2, and presumably any other similar algorithms, there really is
> no sorting needed on the client side by default.  However, I had no way to
> tell RoundCube to drop what it had stored and do no sorting at all.  That
> is, once a sort order gets saved in the database you seem to be locked in
> to sort fields/orders that are available through the interface and there
> was no obvious way to make it forget that and just let the server do all
> the sorting.  In my case, 99.99% of the time I'm going to want to sort DESC
> by date, but in the special way that X-REFERENCES2 implements it.  The 2nd
> patch just means that if you do a special sorting through the interface
> that it will only implement it until you make some other action, at which
> point it will just automatically revert to no sort, letting the IMAP
> server do it's thing.

I am just finishing a patch that adds a new sort column 'default' that
will trigger default sorting. You can enable it by clicking the Date
column DESC -> ASC -> 'default' -> DESC... This should give us what we
want (default sorting) and work with the existing infrastructure.

> About the expanding of messages: my intention is that any thread with an
> unread message will be expanded as necessary to reveal the unread message.
> If it encounters sub-threads along the way whose children are all read then
> it will leave that sub-thread collapsed.  Basically, expand as necessary so
> that no unread messages is ever hidden, yet only expand just enough so that
> this is true.  It seems to be working fine.

Ok. This is not what I would want, but is what you would want, so
there's obviously a case here for making the policy configurable.

> A note about my follow up message.  I was incorrect.  The follow up patch I
> sent caused it appear to start working, but on closer inspection later, the
> sorting was not quite correct. The problem I was experiencing was like
> this: a folder seems to be working fine, the INBOX, for example, but as
> soon I would move a message from there to another folder suddenly RoundCube
> would tell me that there were no messages in the INBOX, yet the unread
> count next to the folder name would reveal the truth.  I still haven't 100%
> figured it out, but it's related to the value of $max that gets set around
> line 590 of ./program/include/rcube_imap.php.  That $max value when using
> the X-REFERENCES algorithm gets set to a value 1 greater than the actual
> correct number, because the function iil_C_Thread() seems to be returning
> this spurious value.  I can get around the problem in one of two ways for
> now: 1) delete the files dovecot.* in the actual INBOX maildir directory 2)
> set $max = $this->_messagecount($mailbox, 'ALL');, which seems to work fine
> even with the threaded implementation.  Any thoughts on this?

I think $max being +1 is intentional (I can't remember why). As for
moving messages, I only tested that briefly so there's likely to be
bugs in my original implementation.

List info: http://lists.roundcube.net/dev/

More information about the Dev mailing list