From 8cfd3ff60b8964f6f335dd1ee48fc40a92f704fd Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan.bosch@open-xchange.com>
Date: Wed, 31 Jul 2019 22:37:47 +0200
Subject: [PATCH] global: Rename all sieve action events to a uniform
 "sieve_action_finished".

The action name can be determined from the sieve_action_name field that existed
before.
---
 src/lib-sieve/cmd-discard.c                           | 4 +---
 src/lib-sieve/cmd-redirect.c                          | 3 +--
 src/lib-sieve/ext-reject.c                            | 4 +---
 src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c    | 3 +--
 src/lib-sieve/plugins/notify/cmd-notify.c             | 3 +--
 src/lib-sieve/plugins/vacation/cmd-vacation.c         | 3 +--
 src/lib-sieve/plugins/vnd.dovecot/report/cmd-report.c | 3 +--
 src/lib-sieve/sieve-actions.c                         | 3 +--
 src/plugins/sieve-extprograms/cmd-pipe.c              | 3 +--
 9 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/src/lib-sieve/cmd-discard.c b/src/lib-sieve/cmd-discard.c
index 847550e4a..9c59e581d 100644
--- a/src/lib-sieve/cmd-discard.c
+++ b/src/lib-sieve/cmd-discard.c
@@ -161,9 +161,7 @@ act_discard_commit(const struct sieve_action_exec_env *aenv,
 
 	eenv->exec_status->significant_action_executed = TRUE;
 
-	struct event_passthrough *e =
-		event_create_passthrough(aenv->event)->
-		set_name("sieve_action_discard");
+	struct event_passthrough *e = sieve_action_create_finish_event(aenv);
 
 	sieve_result_event_log(aenv, e->event(),
 		"Marked message to be discarded if not explicitly delivered "
diff --git a/src/lib-sieve/cmd-redirect.c b/src/lib-sieve/cmd-redirect.c
index 5ce0e3105..efe504086 100644
--- a/src/lib-sieve/cmd-redirect.c
+++ b/src/lib-sieve/cmd-redirect.c
@@ -587,8 +587,7 @@ act_redirect_commit(const struct sieve_action_exec_env *aenv,
 		eenv->exec_status->significant_action_executed = TRUE;
 
 		struct event_passthrough *e =
-			event_create_passthrough(aenv->event)->
-			set_name("sieve_action_redirect")->
+			sieve_action_create_finish_event(aenv)->
 			add_str("sieve_redirect_target",
 				smtp_address_encode(ctx->to_address));
 
diff --git a/src/lib-sieve/ext-reject.c b/src/lib-sieve/ext-reject.c
index 268d79139..527541e54 100644
--- a/src/lib-sieve/ext-reject.c
+++ b/src/lib-sieve/ext-reject.c
@@ -547,9 +547,7 @@ act_reject_commit(const struct sieve_action_exec_env *aenv,
 
 	eenv->exec_status->significant_action_executed = TRUE;
 
-	struct event_passthrough *e =
-		event_create_passthrough(aenv->event)->
-		set_name("sieve_action_reject");
+	struct event_passthrough *e = sieve_action_create_finish_event(aenv);
 
 	sieve_result_event_log(aenv, e->event(),
 			       "rejected message from <%s> (%s)",
diff --git a/src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c b/src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c
index 1d9e3c2d0..17648a0aa 100644
--- a/src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c
+++ b/src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c
@@ -719,8 +719,7 @@ static int ntfy_mailto_send
 		}
 	} else {
 		struct event_passthrough *e =
-			event_create_passthrough(nenv->event)->
-			set_name("sieve_action_notify")->
+			sieve_enotify_create_finish_event(nenv)->
 			add_str("sieve_notify_target", str_c(all));
 
 		sieve_enotify_event_log(nenv, e->event(),
diff --git a/src/lib-sieve/plugins/notify/cmd-notify.c b/src/lib-sieve/plugins/notify/cmd-notify.c
index 2f58b95a2..7c820d634 100644
--- a/src/lib-sieve/plugins/notify/cmd-notify.c
+++ b/src/lib-sieve/plugins/notify/cmd-notify.c
@@ -836,8 +836,7 @@ act_notify_send(const struct sieve_action_exec_env *aenv,
 		}
 	} else {
 		struct event_passthrough *e =
-			event_create_passthrough(aenv->event)->
-			set_name("sieve_action_notify")->
+			sieve_action_create_finish_event(aenv)->
 			add_str("sieve_notify_target", str_c(all));
 
 		sieve_result_event_log(aenv, e->event(),
diff --git a/src/lib-sieve/plugins/vacation/cmd-vacation.c b/src/lib-sieve/plugins/vacation/cmd-vacation.c
index a31d75639..414f6f132 100644
--- a/src/lib-sieve/plugins/vacation/cmd-vacation.c
+++ b/src/lib-sieve/plugins/vacation/cmd-vacation.c
@@ -1520,8 +1520,7 @@ act_vacation_commit(const struct sieve_action_exec_env *aenv,
 		eenv->exec_status->significant_action_executed = TRUE;
 
 		struct event_passthrough *e =
-			event_create_passthrough(aenv->event)->
-			set_name("sieve_action_vacation");
+			sieve_action_create_finish_event(aenv);
 
 		sieve_result_event_log(aenv, e->event(),
 				       "sent vacation response to <%s>",
diff --git a/src/lib-sieve/plugins/vnd.dovecot/report/cmd-report.c b/src/lib-sieve/plugins/vnd.dovecot/report/cmd-report.c
index 09cd1cbbd..e950307e6 100644
--- a/src/lib-sieve/plugins/vnd.dovecot/report/cmd-report.c
+++ b/src/lib-sieve/plugins/vnd.dovecot/report/cmd-report.c
@@ -654,8 +654,7 @@ act_report_send(const struct sieve_action_exec_env *aenv,
 		eenv->exec_status->significant_action_executed = TRUE;
 
 		struct event_passthrough *e =
-			event_create_passthrough(aenv->event)->
-			set_name("sieve_action_report")->
+			sieve_action_create_finish_event(aenv)->
 			add_str("sieve_report_target",
 				smtp_address_encode(act->to_address))->
 			add_str("sieve_report_type",
diff --git a/src/lib-sieve/sieve-actions.c b/src/lib-sieve/sieve-actions.c
index a2eafc804..28f8d6935 100644
--- a/src/lib-sieve/sieve-actions.c
+++ b/src/lib-sieve/sieve-actions.c
@@ -728,8 +728,7 @@ act_store_log_status(struct act_store_transaction *trans,
 	/* Succeeded */
 	} else {
 		struct event_passthrough *e =
-			event_create_passthrough(aenv->event)->
-			set_name("sieve_action_fileinto")->
+			sieve_action_create_finish_event(aenv)->
 			add_str("sieve_fileinto_mailbox", mailbox_name);
 		sieve_result_event_log(aenv, e->event(),
 				       "stored mail into mailbox %s",
diff --git a/src/plugins/sieve-extprograms/cmd-pipe.c b/src/plugins/sieve-extprograms/cmd-pipe.c
index bac37af35..0adbef897 100644
--- a/src/plugins/sieve-extprograms/cmd-pipe.c
+++ b/src/plugins/sieve-extprograms/cmd-pipe.c
@@ -361,8 +361,7 @@ act_pipe_commit(const struct sieve_action_exec_env *aenv,
 
 	if (ret > 0) {
 		struct event_passthrough *e =
-			event_create_passthrough(aenv->event)->
-			set_name("sieve_action_pipe")->
+			sieve_action_create_finish_event(aenv)->
 			add_str("sieve_pipe_program",
 				str_sanitize(act->program_name, 256));
 
-- 
GitLab