From e86e60681dd4cfbc37111dcd41466afd1a843d54 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan@rename-it.nl> Date: Sat, 27 Dec 2008 00:09:43 +0100 Subject: [PATCH] Moved new_message_id function to sieve-message.c where it is more appropriate. --- src/lib-sieve/ext-reject.c | 3 ++- src/lib-sieve/plugins/enotify/ntfy-mailto.c | 25 ++++++++++++------- src/lib-sieve/plugins/vacation/cmd-vacation.c | 3 ++- src/lib-sieve/sieve-actions.c | 15 ----------- src/lib-sieve/sieve-actions.h | 9 +------ src/lib-sieve/sieve-message.c | 19 +++++++++++--- src/lib-sieve/sieve-message.h | 11 +++++--- 7 files changed, 45 insertions(+), 40 deletions(-) diff --git a/src/lib-sieve/ext-reject.c b/src/lib-sieve/ext-reject.c index 6e61f951f..2d3a2a044 100644 --- a/src/lib-sieve/ext-reject.c +++ b/src/lib-sieve/ext-reject.c @@ -33,6 +33,7 @@ #include "sieve-interpreter.h" #include "sieve-dump.h" #include "sieve-result.h" +#include "sieve-message.h" /* * Forward declarations @@ -319,7 +320,7 @@ static bool act_reject_send smtp_handle = senv->smtp_open(msgdata->return_path, NULL, &f); - new_msgid = sieve_get_new_message_id(senv); + new_msgid = sieve_message_get_new_id(senv); boundary = t_strdup_printf("%s/%s", my_pid, senv->hostname); rfc2822_header_field_write(f, "X-Sieve", SIEVE_IMPLEMENTATION); diff --git a/src/lib-sieve/plugins/enotify/ntfy-mailto.c b/src/lib-sieve/plugins/enotify/ntfy-mailto.c index 854cd29e4..e2871b7a8 100644 --- a/src/lib-sieve/plugins/enotify/ntfy-mailto.c +++ b/src/lib-sieve/plugins/enotify/ntfy-mailto.c @@ -1,6 +1,16 @@ /* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file */ +/* Notify method mailto + * -------------------- + * + * Authors: Stephan Bosch + * Specification: draft-ietf-sieve-notify-mailto-10.txt + * Implementation: almost full + * Status: under development + * + */ + #include "lib.h" #include "array.h" #include "str.h" @@ -11,15 +21,13 @@ #include "rfc2822.h" -#include "sieve-common.h" +#include "sieve-ext-enotify.h" #include "sieve-address.h" +#include "sieve-message.h" /* To be removed */ -#include "sieve-actions.h" #include "sieve-result.h" -#include "sieve-ext-enotify.h" - /* * Configuration */ @@ -449,7 +457,6 @@ static bool ntfy_mailto_parse_uri (const struct sieve_enotify_log *nlog, const char *uri_body, ARRAY_TYPE(recipients) *recipients_r, ARRAY_TYPE(headers) *headers_r, const char **body, const char **subject) - { const char *p = uri_body; @@ -491,14 +498,14 @@ static bool ntfy_mailto_parse_uri */ static bool ntfy_mailto_compile_check_uri - (const struct sieve_enotify_log *nlog, const char *uri, - const char *uri_body) +(const struct sieve_enotify_log *nlog, const char *uri ATTR_UNUSED, + const char *uri_body) { return ntfy_mailto_parse_uri(nlog, uri_body, NULL, NULL, NULL, NULL); } static bool ntfy_mailto_compile_check_from - (const struct sieve_enotify_log *nlog, string_t *from) +(const struct sieve_enotify_log *nlog, string_t *from) { const char *error; bool result = FALSE; @@ -721,7 +728,7 @@ static bool ntfy_mailto_send unsigned int h, hcount; smtp_handle = senv->smtp_open(recipients[i].normalized, from, &f); - outmsgid = sieve_get_new_message_id(senv); + outmsgid = sieve_message_get_new_id(senv); rfc2822_header_field_write(f, "X-Sieve", SIEVE_IMPLEMENTATION); rfc2822_header_field_write(f, "Message-ID", outmsgid); diff --git a/src/lib-sieve/plugins/vacation/cmd-vacation.c b/src/lib-sieve/plugins/vacation/cmd-vacation.c index 191b8ece1..4f096ce55 100644 --- a/src/lib-sieve/plugins/vacation/cmd-vacation.c +++ b/src/lib-sieve/plugins/vacation/cmd-vacation.c @@ -24,6 +24,7 @@ #include "sieve-interpreter.h" #include "sieve-dump.h" #include "sieve-result.h" +#include "sieve-message.h" #include "ext-vacation-common.h" @@ -832,7 +833,7 @@ static bool act_vacation_send /* Open smtp session */ smtp_handle = senv->smtp_open(msgdata->return_path, NULL, &f); - outmsgid = sieve_get_new_message_id(senv); + outmsgid = sieve_message_get_new_id(senv); /* Produce a proper reply */ diff --git a/src/lib-sieve/sieve-actions.c b/src/lib-sieve/sieve-actions.c index 39cf8dc19..bd5e1d265 100644 --- a/src/lib-sieve/sieve-actions.c +++ b/src/lib-sieve/sieve-actions.c @@ -3,7 +3,6 @@ #include "lib.h" #include "strfuncs.h" -#include "ioloop.h" #include "str-sanitize.h" #include "mail-storage.h" #include "mail-namespace.h" @@ -16,20 +15,6 @@ #include "sieve-result.h" #include "sieve-actions.h" -/* - * Message transmission (FIXME: place this somewhere more appropriate) - */ - -const char *sieve_get_new_message_id - (const struct sieve_script_env *senv) -{ - static int count = 0; - - return t_strdup_printf("<dovecot-sieve-%s-%s-%d@%s>", - dec2str(ioloop_timeval.tv_sec), dec2str(ioloop_timeval.tv_usec), - count++, senv->hostname); -} - /* * Action execution environment */ diff --git a/src/lib-sieve/sieve-actions.h b/src/lib-sieve/sieve-actions.h index 135414f2a..1e91dde96 100644 --- a/src/lib-sieve/sieve-actions.h +++ b/src/lib-sieve/sieve-actions.h @@ -191,12 +191,5 @@ int sieve_act_store_add_to_result (const struct sieve_runtime_env *renv, struct sieve_side_effects_list *seffects, const char *folder, unsigned int source_line); - -/* - * Message transmission (FIXME: put this somewhere else) - */ - -const char *sieve_get_new_message_id - (const struct sieve_script_env *senv); - + #endif /* __SIEVE_ACTIONS_H */ diff --git a/src/lib-sieve/sieve-message.c b/src/lib-sieve/sieve-message.c index fab43b25c..61901e8fb 100644 --- a/src/lib-sieve/sieve-message.c +++ b/src/lib-sieve/sieve-message.c @@ -2,6 +2,7 @@ */ #include "lib.h" +#include "ioloop.h" #include "mempool.h" #include "array.h" @@ -9,6 +10,20 @@ #include "sieve-message.h" #include "sieve-extensions.h" +/* + * Message transmission + */ + +const char *sieve_message_get_new_id +(const struct sieve_script_env *senv) +{ + static int count = 0; + + return t_strdup_printf("<dovecot-sieve-%s-%s-%d@%s>", + dec2str(ioloop_timeval.tv_sec), dec2str(ioloop_timeval.tv_usec), + count++, senv->hostname); +} + /* * Message context */ @@ -70,9 +85,7 @@ pool_t sieve_message_context_pool(struct sieve_message_context *msgctx) return msgctx->pool; } -/* - * Extension support - */ +/* Extension support */ void sieve_message_context_extension_set (struct sieve_message_context *msgctx, const struct sieve_extension *ext, diff --git a/src/lib-sieve/sieve-message.h b/src/lib-sieve/sieve-message.h index 627a8a61c..aa0c8d7d6 100644 --- a/src/lib-sieve/sieve-message.h +++ b/src/lib-sieve/sieve-message.h @@ -4,6 +4,13 @@ #ifndef __SIEVE_MESSAGE_H #define __SIEVE_MESSAGE_H +/* + * Message transmission + */ + +const char *sieve_message_get_new_id + (const struct sieve_script_env *senv); + /* * Message context */ @@ -19,9 +26,7 @@ void sieve_message_context_flush(struct sieve_message_context *msgctx); pool_t sieve_message_context_pool (struct sieve_message_context *msgctx); -/* - * Extension support - */ +/* Extension support */ void sieve_message_context_extension_set (struct sieve_message_context *msgctx, const struct sieve_extension *ext, -- GitLab