dovecot-2.1: lib-storage: Added mailbox_save_using_mail()

dovecot at dovecot.org dovecot at dovecot.org
Fri Jan 6 15:24:04 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/1e58372ee6f0
changeset: 13896:1e58372ee6f0
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jan 06 15:22:52 2012 +0200
description:
lib-storage: Added mailbox_save_using_mail()

diffstat:

 src/lib-storage/mail-storage-private.h |  2 ++
 src/lib-storage/mail-storage.c         |  7 +++++++
 src/lib-storage/mail-storage.h         |  4 ++++
 3 files changed, 13 insertions(+), 0 deletions(-)

diffs (50 lines):

diff -r 7f549b7eb77f -r 1e58372ee6f0 src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h	Fri Jan 06 15:17:20 2012 +0200
+++ b/src/lib-storage/mail-storage-private.h	Fri Jan 06 15:22:52 2012 +0200
@@ -449,6 +449,8 @@
 
 	/* mail was copied using saving */
 	unsigned int copying_via_save:1;
+	/* mail is being saved, not copied */
+	unsigned int saving:1;
 };
 
 struct mailbox_sync_context {
diff -r 7f549b7eb77f -r 1e58372ee6f0 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Fri Jan 06 15:17:20 2012 +0200
+++ b/src/lib-storage/mail-storage.c	Fri Jan 06 15:22:52 2012 +0200
@@ -1613,6 +1613,7 @@
 		return -1;
 	}
 
+	(*ctx)->saving = TRUE;
 	if (box->v.save_begin == NULL) {
 		mail_storage_set_error(box->storage, MAIL_ERROR_NOTPOSSIBLE,
 				       "Saving messages not supported");
@@ -1685,6 +1686,12 @@
 	return ret;
 }
 
+int mailbox_save_using_mail(struct mail_save_context **ctx, struct mail *mail)
+{
+	(*ctx)->saving = TRUE;
+	return mailbox_copy(ctx, mail);
+}
+
 bool mailbox_is_inconsistent(struct mailbox *box)
 {
 	return box->mailbox_deleted || box->v.is_inconsistent(box);
diff -r 7f549b7eb77f -r 1e58372ee6f0 src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h	Fri Jan 06 15:17:20 2012 +0200
+++ b/src/lib-storage/mail-storage.h	Fri Jan 06 15:22:52 2012 +0200
@@ -666,6 +666,10 @@
 /* Copy the given message. You'll need to specify the flags etc. using the
    mailbox_save_*() functions. */
 int mailbox_copy(struct mail_save_context **ctx, struct mail *mail);
+/* Same as mailbox_copy(), but treat the message as if it's being saved,
+   not copied. (For example: New mail delivered to multiple maildirs, with
+   each mails being hard link copies.) */
+int mailbox_save_using_mail(struct mail_save_context **ctx, struct mail *mail);
 
 struct mail *mail_alloc(struct mailbox_transaction_context *t,
 			enum mail_fetch_field wanted_fields,


More information about the dovecot-cvs mailing list