dovecot-2.2: virtual plugin: Fixed saving/copying messages to vi...

dovecot at dovecot.org dovecot at dovecot.org
Sun Mar 31 17:25:24 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/9a8119326bd0
changeset: 16130:9a8119326bd0
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Mar 31 17:25:10 2013 +0300
description:
virtual plugin: Fixed saving/copying messages to virtual mailbox.

diffstat:

 src/lib-storage/mail-storage.c     |  9 +++++----
 src/plugins/virtual/virtual-save.c |  6 +++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diffs (49 lines):

diff -r 12136db6e31f -r 9a8119326bd0 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Sun Mar 31 17:24:35 2013 +0300
+++ b/src/lib-storage/mail-storage.c	Sun Mar 31 17:25:10 2013 +0300
@@ -1813,7 +1813,6 @@
 {
 	struct mailbox_transaction_context *t = *_t;
 	unsigned int save_count = t->save_count;
-	bool assign_uids = (t->flags & MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS) != 0;
 	int ret;
 
 	t->box->transaction_count--;
@@ -1823,9 +1822,11 @@
 	T_BEGIN {
 		ret = t->box->v.transaction_commit(t, changes_r);
 	} T_END;
-	i_assert(ret < 0 ||
-		 seq_range_count(&changes_r->saved_uids) == save_count ||
-		 (array_count(&changes_r->saved_uids) == 0 && !assign_uids));
+	/* either all the saved messages get UIDs or none, because a) we
+	   failed, b) MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS not set,
+	   c) backend doesn't support it (e.g. virtual plugin) */
+	i_assert(seq_range_count(&changes_r->saved_uids) == save_count ||
+		 array_count(&changes_r->saved_uids) == 0);
 	if (ret < 0 && changes_r->pool != NULL)
 		pool_unref(&changes_r->pool);
 	return ret;
diff -r 12136db6e31f -r 9a8119326bd0 src/plugins/virtual/virtual-save.c
--- a/src/plugins/virtual/virtual-save.c	Sun Mar 31 17:24:35 2013 +0300
+++ b/src/plugins/virtual/virtual-save.c	Sun Mar 31 17:25:10 2013 +0300
@@ -113,7 +113,10 @@
 {
 	struct virtual_save_context *ctx = (struct virtual_save_context *)_ctx;
 
-	return mailbox_save_finish(&ctx->backend_save_ctx);
+	if (mailbox_save_finish(&ctx->backend_save_ctx) < 0)
+		return -1;
+	_ctx->unfinished = FALSE;
+	return 0;
 }
 
 void virtual_save_cancel(struct mail_save_context *_ctx)
@@ -122,6 +125,7 @@
 
 	if (ctx->backend_save_ctx != NULL)
 		mailbox_save_cancel(&ctx->backend_save_ctx);
+	_ctx->unfinished = FALSE;
 }
 
 void virtual_save_free(struct mail_save_context *_ctx)


More information about the dovecot-cvs mailing list