On Tue, 2007-09-25 at 09:58 -0500, Kyle Wheeler wrote:
> 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.

So, something like:

const char *const *headers = mail_get_headers(mail, "Received");
if (headers != NULL && headers[0] != NULL) {
  while (headers[1] != NULL) headers++;
  // do your Received header parsing magic for headers[0]
}

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to