Hi Ryo,
First, a little background; I originally set up my e-mail solution a few months ago by creating myself a Maildir on my Debian box. Using Thunderbird, where my e-mails were stored locally on my PC, I copied across all my e-mails to the server by dragging and dropping the folders.
The trouble I have with this is that the date modified timestamp of each e-mail was dependent on the time that the Thunderbird application copied them over to the server. Unfortunately for me, it didn't copy them across in a 'logical' order and consequently the default sorting by 'timestamp' meant that the order was all scrambled (any new e-mails would correctly arrive at the top of the e-mail list, however).
To date, I haven't found a nice way of resetting the modified date of those e-mail files based on the 'Date:' field contained within the e-mail file. I suspect doing that may be a better solution to my problem, but instead I have made an amendment to the imap.inc file, which I suspect may in fact be a better solution for anyone facing the same problem.
I have added the following lines to the 'iil_SortHeaders' function, after line 1370 (inside the first if-statement);
if ($field=="timestamp")
{
foreach ($a as $value)
{
$timestamp = strtotime($value->date);
if ($timestamp != false)
{
$value->timestamp = $timestamp;
}
}
}
I am interested to know whether you think this is a viable solution and whether the above change could be integrated into your module.
The only issue I can see with this is that the 'Date:' field inside the e-mail is dependent on the sending party's server and that could theoretically be set to anything.
Also, for one particular e-mail I had, the timestamp was not in a format that the strtotime function could understand (it looked like this: 'Fri, 12 Mar 2004 13:35:05 +0000 ()' and it doesn't like the empty brackets), hence the check for $timestamp != false, which if it fails will cause it to revert to the date modified timestamp of the file.
Thanks for your attention!
Kind regards, Richard