From c445794f47c0ee395e3078ccca62d0a17d5cb792 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan@rename-it.nl> Date: Mon, 26 Nov 2007 19:31:38 +0100 Subject: [PATCH] Made discard command add discard action to the result. --- sieve/tests/actions.sieve | 13 +++++++++++++ src/lib-sieve/cmd-discard.c | 27 +++++++++++++++++++++++++++ src/lib-sieve/cmd-keep.c | 1 - 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 sieve/tests/actions.sieve diff --git a/sieve/tests/actions.sieve b/sieve/tests/actions.sieve new file mode 100644 index 000000000..9fd9b6b32 --- /dev/null +++ b/sieve/tests/actions.sieve @@ -0,0 +1,13 @@ +if address :contains "to" "vestingbar" { + redirect "stephan@example.com"; + keep; +} else { + discard; +} + +redirect "stephan@rename-it.nl"; +redirect "nico@example.nl"; +redirect "stephan@example.com"; + +keep; +discard; diff --git a/src/lib-sieve/cmd-discard.c b/src/lib-sieve/cmd-discard.c index eb3cd1834..660dd8e6e 100644 --- a/src/lib-sieve/cmd-discard.c +++ b/src/lib-sieve/cmd-discard.c @@ -42,6 +42,18 @@ const struct sieve_opcode cmd_discard_opcode = { opc_discard_execute }; +/* Discard action */ + +static int act_discard_execute + (const struct sieve_action *action, const struct sieve_action_exec_env *aenv, + void *context); + +const struct sieve_action act_discard = { + "discard", + NULL, NULL, NULL, + act_discard_execute +}; + /* * Generation */ @@ -66,7 +78,22 @@ static bool opc_discard_execute { printf(">> DISCARD\n"); + sieve_result_add_action(renv->result, renv, &act_discard, NULL); + return TRUE; } +/* + * Action + */ + +static int act_discard_execute +(const struct sieve_action *action ATTR_UNUSED, + const struct sieve_action_exec_env *aenv, void *context) +{ + + return 0; +} + + diff --git a/src/lib-sieve/cmd-keep.c b/src/lib-sieve/cmd-keep.c index 68b7599f3..4acbd98eb 100644 --- a/src/lib-sieve/cmd-keep.c +++ b/src/lib-sieve/cmd-keep.c @@ -54,7 +54,6 @@ const struct sieve_action act_keep = { act_keep_execute }; - /* * Generation */ -- GitLab