[Dovecot] SORT(DATE) and missing Date headers

Kyle Wheeler kyle-dovecot at memoryhole.net
Tue Sep 25 17:58:20 EEST 2007


On Tuesday, September 25 at 12:39 PM, quoth Timo Sirainen:
>> How hard would this be to hack into the current Dovecot source?
>
>Replace mail_get_date() calls in src/imap/imap-sort.c with something
>like:
>
>t = mail_get_date(..);
>if (t == (time_t)-1) t = mail_get_received_date(..);

That's not *quite* what I meant. ARRIVAL is "when did this mail get 
here", while DATE is supposed to be "when was this mail sent". My 
thought here is that "when was this mail sent" can be approximated in 
the absence of a Date header by checking the earliest timestamp in the 
Received headers. mail_get_received_date() returns the *latest* 
timestamp in the Received headers (actually, in a Maildir backend, it 
just returns the fstat of the message file), so in a folder full of 
messages without Date headers, SORT(DATE) and SORT(ARRIVAL) would be 
identical, which is not what I'm aiming for.

But, looking at it, I guess this becomes pretty difficult. To work 
around the fstat, I'd have to do something even more complicated than 
an mbox _read() to find the Received header with the oldest timestamp. 
Is that correct?

~Kyle
-- 
The sacred rights of mankind are not to be rummaged for, among old 
parchments, or musty records. They are written, as with a sun beam in 
the whole volume of human nature, by the hand of the divinity itself; 
and can never be erased or obscured by mortal power.
                                            -- Alexander Hamilton, 1775
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20070925/5c23606e/attachment.bin 


More information about the dovecot mailing list