dovecot-2.2: pop3c: Return Date: header's date also as received ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 12 16:43:48 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/d447dcc6b611
changeset: 16495:d447dcc6b611
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 12 16:43:41 2013 +0300
description:
pop3c: Return Date: header's date also as received and saved date.
Mainly to get dsync to not fail.

diffstat:

 src/lib-storage/index/pop3c/pop3c-mail.c |  23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diffs (37 lines):

diff -r 8cf22cba16d4 -r d447dcc6b611 src/lib-storage/index/pop3c/pop3c-mail.c
--- a/src/lib-storage/index/pop3c/pop3c-mail.c	Wed Jun 12 16:29:17 2013 +0300
+++ b/src/lib-storage/index/pop3c/pop3c-mail.c	Wed Jun 12 16:43:41 2013 +0300
@@ -9,18 +9,25 @@
 
 static int pop3c_mail_get_received_date(struct mail *_mail, time_t *date_r)
 {
-	mail_storage_set_error(_mail->box->storage, MAIL_ERROR_NOTPOSSIBLE,
-			       "POP3 has no received date");
-	*date_r = (time_t)-1;
-	return -1;
+	int tz;
+
+	/* FIXME: we could also parse the first Received: header and get
+	   the date from there, but since this code is unlikely to be called
+	   except during migration, I don't think it really matters. */
+	return index_mail_get_date(_mail, date_r, &tz);
 }
 
 static int pop3c_mail_get_save_date(struct mail *_mail, time_t *date_r)
 {
-	mail_storage_set_error(_mail->box->storage, MAIL_ERROR_NOTPOSSIBLE,
-			       "POP3 has no save date");
-	*date_r = (time_t)-1;
-	return -1;
+	struct index_mail *mail = (struct index_mail *)_mail;
+	struct index_mail_data *data = &mail->data;
+
+	if (data->save_date == (time_t)-1) {
+		/* FIXME: we could use a value stored in cache */
+		return pop3c_mail_get_received_date(_mail, date_r);
+	}
+	*date_r = data->save_date;
+	return 0;
 }
 
 static int pop3c_mail_get_physical_size(struct mail *_mail, uoff_t *size_r)


More information about the dovecot-cvs mailing list