Author Topic: Sort by Date doesn't work if mails have been moved  (Read 8568 times)

Offline ted_simple

  • Newbie
  • *
  • Posts: 2
Sort by Date doesn't work if mails have been moved
« 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.

Offline ted_simple

  • Newbie
  • *
  • Posts: 2
Re: Sort by Date doesn't work if mails have been moved
« Reply #1 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.

Offline bagu

  • Full Member
  • ***
  • Posts: 109
    • Bagu.biz
Sort by Date doesn't work if mails have been moved
« Reply #2 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...
« Last Edit: February 01, 2010, 11:57:57 AM by bagu »

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
Sort by Date doesn't work if mails have been moved
« Reply #3 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".
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline bagu

  • Full Member
  • ***
  • Posts: 109
    • Bagu.biz
Sort by Date doesn't work if mails have been moved
« Reply #4 on: February 01, 2010, 04:10:28 PM »
I must hide myself under the carpet...

Thanks a lot.

Offline Trizzunkz

  • Jr. Member
  • **
  • Posts: 17
Sort by Date doesn't work if mails have been moved
« Reply #5 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
« Last Edit: March 10, 2010, 05:23:43 PM by Trizzunkz »

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
Sort by Date doesn't work if mails have been moved
« Reply #6 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');
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline Trizzunkz

  • Jr. Member
  • **
  • Posts: 17
Sort by Date doesn't work if mails have been moved
« Reply #7 on: March 10, 2010, 10:07:12 PM »
That's a very handy tip.
Thanks.

Offline dahepe

  • Newbie
  • *
  • Posts: 6
Sort by Date doesn't work if mails have been moved
« Reply #8 on: March 30, 2010, 10:47:24 AM »
Hi,

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

Best regards

Offline Martian

  • Jr. Member
  • **
  • Posts: 35
Sort by Date doesn't work if mails have been moved
« Reply #9 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 ) and it keeps all the metadata in tact so I don't have to worry about this issue.

Martian

Offline dahepe

  • Newbie
  • *
  • Posts: 6
Sort by Date doesn't work if mails have been moved
« Reply #10 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
« Last Edit: March 31, 2010, 03:03:19 AM by dahepe »

Offline Martian

  • Jr. Member
  • **
  • Posts: 35
Sort by Date doesn't work if mails have been moved
« Reply #11 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

Offline dziobak

  • Full Member
  • ***
  • Posts: 184
Sort by Date doesn't work if mails have been moved
« Reply #12 on: March 31, 2010, 04:55:52 PM »
you can try use tar which should not change file attributes and creation/modification dates

Offline Trizzunkz

  • Jr. Member
  • **
  • Posts: 17
Sort by Date doesn't work if mails have been moved
« Reply #13 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.

Offline dahepe

  • Newbie
  • *
  • Posts: 6
Sort by Date doesn't work if mails have been moved
« Reply #14 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...