changeset 7315:3f53f528d338 HEAD

Copies were tracked using the source transaction instead of destination transaction, so rollbacking source transaction logged bogus "transaction rolled back" messages.
author Timo Sirainen <tss@iki.fi>
date Sun, 02 Mar 2008 06:23:59 +0200
parents 3765f80f4d29
children 258477a3f1e7
files src/plugins/mail-log/mail-log-plugin.c
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/mail-log/mail-log-plugin.c	Sun Mar 02 06:09:38 2008 +0200
+++ b/src/plugins/mail-log/mail-log-plugin.c	Sun Mar 02 06:23:59 2008 +0200
@@ -255,11 +255,11 @@
 	}
 }
 
-static void mail_log_action(struct mail *mail, enum mail_log_event event,
+static void mail_log_action(struct mailbox_transaction_context *dest_trans,
+			    struct mail *mail, enum mail_log_event event,
 			    const char *data)
 {
-	struct mail_log_transaction_context *lt =
-		MAIL_LOG_CONTEXT(mail->transaction);
+	struct mail_log_transaction_context *lt = MAIL_LOG_CONTEXT(dest_trans);
 	const char *msgid;
 	uoff_t size;
 	string_t *str;
@@ -272,8 +272,7 @@
 		pool = pool_alloconly_create("mail log transaction", 1024);
 		lt = p_new(pool, struct mail_log_transaction_context, 1);
 		lt->pool = pool;
-		MODULE_CONTEXT_SET(mail->transaction,
-				   mail_log_storage_module, lt);
+		MODULE_CONTEXT_SET(dest_trans, mail_log_storage_module, lt);
 	}
 	lt->changes++;
 
@@ -322,7 +321,8 @@
 	union mail_module_context *lmail = MAIL_LOG_MAIL_CONTEXT(mail);
 
 	T_BEGIN {
-		mail_log_action(_mail, MAIL_LOG_EVENT_EXPUNGE, NULL);
+		mail_log_action(_mail->transaction, _mail,
+				MAIL_LOG_EVENT_EXPUNGE, NULL);
 	} T_END;
 	lmail->super.expunge(_mail);
 }
@@ -354,7 +354,8 @@
 		return;
 
 	T_BEGIN {
-		mail_log_action(_mail, (new_flags & MAIL_DELETED) != 0 ?
+		mail_log_action(_mail->transaction, _mail,
+				(new_flags & MAIL_DELETED) != 0 ?
 				MAIL_LOG_EVENT_DELETE :
 				MAIL_LOG_EVENT_UNDELETE, NULL);
 	} T_END;
@@ -396,7 +397,7 @@
 	T_BEGIN {
 		name = str_sanitize(mailbox_get_name(t->box),
 				    MAILBOX_NAME_LOG_LEN);
-		mail_log_action(mail, MAIL_LOG_EVENT_COPY, name);
+		mail_log_action(t, mail, MAIL_LOG_EVENT_COPY, name);
 	} T_END;
 	return 0;
 }