Roundcube Community Forum

Release Support => Pending Issues => Topic started by: ted_simple on November 27, 2007, 12:29:10 PM

Title: Sort by Date doesn't work if mails have been moved
Post by: ted_simple on November 27, 2007, 12:29:10 PM
Hallo,

I suppose you're aware of this: The sort by date means that mails are sorted in the order in which they arrived in the particular IMAP folder, and not by the actual Send or Received date of the mail.

This renders Roundcube useless for me, because I'm planning to move all my mails to another server, which will mix up the entire date/time order. The correct dates are shown, and it becomes obvious at once that something is wrong:

Sender1  Subject1  Nov 15
Sender2  Subject2  Nov 20
Sender3  Subject3  Nov 11

and so on.
Title: Re: Sort by Date doesn't work if mails have been moved
Post by: ted_simple on November 27, 2007, 01:14:33 PM
Actually, if I set up another sort order

// default sort col
$rcmail_config['message_sort_col'] = 'size';

it doesn't work either. No order is applied. The date column is colored dark grey though.


EDIT: Have decided to move on to another webmail script. But maybe my hints are still useful to you.
Title: Sort by Date doesn't work if mails have been moved
Post by: bagu on February 01, 2010, 10:50:06 AM
This "bug" is still here...

Is there any way to correct this ?
Because moving mail destroy date sort, it's hard to manage folders in imap...
Title: Sort by Date doesn't work if mails have been moved
Post by: ABerglund on February 01, 2010, 02:48:24 PM
In version 0.3 and later, go to Preferences -> User Interface and uncheck the box for "Use message index for sorting by date".
Title: Sort by Date doesn't work if mails have been moved
Post by: bagu on February 01, 2010, 04:10:28 PM
I must hide myself under the carpet...

Thanks a lot.
Title: Sort by Date doesn't work if mails have been moved
Post by: Trizzunkz on March 10, 2010, 05:05:42 PM
Quote from: ABerglund;25091
In version 0.3 and later, go to Preferences -> User Interface and uncheck the box for "Use message index for sorting by date".

I've just discovered this "bug" myself after moving all my mail to our new server. Is there anyway I can set this option off by default, so I don't have to go to all the users and do it manually?

EDIT:
Nevermind. I found it in main.inc.php
Title: Sort by Date doesn't work if mails have been moved
Post by: ABerglund on March 10, 2010, 09:31:54 PM
In addition to setting it to 'off' by default, you can also set it so the user can't see or change it later by adding it to the 'dont_override' array.

Code: [Select]
$rcmail_config['dont_override'] = array('index_sort','trash_mbox','sent_mbox','junk_mbox','drafts_mbox');
Title: Sort by Date doesn't work if mails have been moved
Post by: Trizzunkz on March 10, 2010, 10:07:12 PM
That's a very handy tip.
Thanks.
Title: Sort by Date doesn't work if mails have been moved
Post by: dahepe on March 30, 2010, 10:47:24 AM
Hi,

is there any way to fix the message index for imported mails?

Best regards
Title: Sort by Date doesn't work if mails have been moved
Post by: Martian on March 30, 2010, 11:03:25 AM
Quote from: dahepe;26488
Hi,

is there any way to fix the message index for imported mails?

Best regards


This depends on how you import the messages, what you are importing from / to.

For example I am switching from Cyrus Imap to Dovecot using Cyrus2Dovecot ( Cyrus2Dovecot - Home (http://cyrus2dovecot.sw.fu-berlin.de/) ) and it keeps all the metadata in tact so I don't have to worry about this issue.

Martian
Title: Sort by Date doesn't work if mails have been moved
Post by: dahepe on March 31, 2010, 03:00:45 AM
Is the mail index an issue of the IMAP server or is it maintained by RoundCube?

My "import" was a simple drag and drop from an old Thunderbird POP3 account to a Courier IMAP server.

The German translation mentions that using the mail index for sorting by date performs better than actually sorting by date. If the mail index is a feature of the IMAP server, I would imagine sorting by the date column of the messages table should perform better than relying on a server functionality.

Best regards
Title: Sort by Date doesn't work if mails have been moved
Post by: Martian on March 31, 2010, 03:35:08 PM
When you copy a mail from one IMAP server to another you effectively create a new file on the new IMAP server with the date of the time it was moved.  In other words the new IMAP server sees the message as being "received" when it is copied over NOT when you origianlly recieved it on the old IMAP server.

The only way that I know of to avoid this is to use some sort of script to convert your mail from one format to the other and then copy it over.

Martian
Title: Sort by Date doesn't work if mails have been moved
Post by: dziobak on March 31, 2010, 04:55:52 PM
you can try use tar which should not change file attributes and creation/modification dates
Title: Sort by Date doesn't work if mails have been moved
Post by: Trizzunkz on March 31, 2010, 05:43:53 PM
Sorting by index would techically perform better than sorting by date, but on my system, the difference isn't noticable. Just turn it off, and the problem is gone.
Title: Sort by Date doesn't work if mails have been moved
Post by: dahepe on April 01, 2010, 03:04:50 AM
Hi,

@Martian & @dziobak
Actually the creation date of the message files on the server is correct. That is an imported message that was received on the 13th of January 2009 19:40:56 has as creation timestamp 2009-01-14 19:40:56.00000000. The ctime (time of last modification of the file info) however matches the time of the import. But strangely sorting by ctime on the filesystem doesn't sort the messages in the same order as RoundCube does, when sorting by index.

@Trizzunkz
It think it depends: If the mail index is a feature of the IMAP server, then sorting by the date column of the RoundCube messages database table, should perform better, at least from my feeling. If the index is of course maintained by RoundCube and based on the RoundCube database, then sorting by this index should/will perform better, but than it should be possible to fix this index by a relatively simple SQL-statement.

Regards

P.S.: Of course switching of the "Sort messages by index, when sorting by date" option solves the issue. I'm just wondering what this mysterious index is based on...
Title: Sort by Date doesn't work if mails have been moved
Post by: alec on April 01, 2010, 11:12:38 AM
Index sorting is a sorting by internal IMAP message sequence number (RFC3501). This is eg. default order of messages when they are returned by FETCH command. BTW, in current svn-trunk version you can sort by index, sent date or arrival date.