[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-mail.c, 1.34, 1.35

tss-movial at dovecot.org tss-movial at dovecot.org
Thu Jun 29 14:09:01 EEST 2006


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

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



Index: mbox-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-mail.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- mbox-mail.c	16 May 2006 09:10:34 -0000	1.34
+++ mbox-mail.c	29 Jun 2006 11:08:58 -0000	1.35
@@ -1,6 +1,7 @@
-/* Copyright (C) 2003 Timo Sirainen */
+/* Copyright (C) 2003-2006 Timo Sirainen */
 
 #include "lib.h"
+#include "ioloop.h"
 #include "istream.h"
 #include "index-mail.h"
 #include "mbox-storage.h"
@@ -111,6 +112,24 @@
 	return data->received_date;
 }
 
+static time_t mbox_mail_get_save_date(struct mail *_mail)
+{
+	struct index_mail *mail = (struct index_mail *)_mail;
+	struct index_mail_data *data = &mail->data;
+
+	(void)index_mail_get_save_date(_mail);
+	if (data->save_date != (time_t)-1)
+		return data->save_date;
+
+	/* no way to know this. save the current time into cache and use
+	   that from now on. this works only as long as the index files
+	   are permanent */
+	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 const char *
 mbox_mail_get_special(struct mail *_mail, enum mail_fetch_field field)
 {
@@ -207,8 +226,9 @@
 	index_mail_get_flags,
 	index_mail_get_keywords,
 	index_mail_get_parts,
-	mbox_mail_get_received_date,
 	index_mail_get_date,
+	mbox_mail_get_received_date,
+	mbox_mail_get_save_date,
 	index_mail_get_virtual_size,
 	mbox_mail_get_physical_size,
 	index_mail_get_first_header,



More information about the dovecot-cvs mailing list