[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-mail.c, 1.12, 1.13

tss-movial at dovecot.org tss-movial at dovecot.org
Thu Jun 29 14:08:59 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv13610/index/dbox

Modified Files:
	dbox-mail.c 
Log Message:
Added mail_get_save_date() and some cleanups.



Index: dbox-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-mail.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- dbox-mail.c	12 Jun 2006 08:24:44 -0000	1.12
+++ dbox-mail.c	29 Jun 2006 11:08:57 -0000	1.13
@@ -1,6 +1,7 @@
 /* Copyright (C) 2005 Timo Sirainen */
 
 #include "lib.h"
+#include "ioloop.h"
 #include "hex-dec.h"
 #include "read-full.h"
 #include "istream.h"
@@ -164,6 +165,29 @@
 	return data->received_date;
 }
 
+static time_t dbox_mail_get_save_date(struct mail *_mail)
+{
+	struct index_mail *mail = (struct index_mail *)_mail;
+	struct index_mail_data *data = &mail->data;
+	uoff_t offset;
+
+	(void)index_mail_get_save_date(_mail);
+	if (data->save_date != (time_t)-1)
+		return data->save_date;
+
+	if (dbox_mail_open(mail, &offset) <= 0)
+		return (time_t)-1;
+	if (data->save_date == (time_t)-1) {
+		/* it's broken and conflicts with our "not found"
+		   return value. change it. */
+		data->save_date = ioloop_time;
+	}
+
+	index_mail_cache_add(mail, MAIL_CACHE_SAVE_DATE,
+			     &data->save_date, sizeof(data->save_date));
+	return data->save_date;
+}
+
 static uoff_t dbox_mail_get_physical_size(struct mail *_mail)
 {
 	struct index_mail *mail = (struct index_mail *)_mail;
@@ -214,8 +238,9 @@
 	index_mail_get_flags,
 	index_mail_get_keywords,
 	index_mail_get_parts,
-	dbox_mail_get_received_date,
 	index_mail_get_date,
+	dbox_mail_get_received_date,
+	dbox_mail_get_save_date,
 	dbox_mail_get_physical_size, /* physical = virtual in our case */
 	dbox_mail_get_physical_size,
 	index_mail_get_first_header,



More information about the dovecot-cvs mailing list