]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
pop3c: Return Date: header's date also as received and saved date.
authorTimo Sirainen <tss@iki.fi>
Wed, 12 Jun 2013 13:43:41 +0000 (16:43 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 12 Jun 2013 13:43:41 +0000 (16:43 +0300)
Mainly to get dsync to not fail.

src/lib-storage/index/pop3c/pop3c-mail.c

index 3ae6ddd364da6f5cb6b3df9d6a6a27d3db416dbc..4a1ef5b940068c6dda80ef00d81ee4dd0226c781 100644 (file)
@@ -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)