dovecot-2.0-pigeonhole: Simplified runtime command script locati...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Mon Aug 30 03:19:03 EEST 2010
details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/0e80e5a03870
changeset: 1395:0e80e5a03870
user: Stephan Bosch <stephan at rename-it.nl>
date: Mon Aug 30 02:18:54 2010 +0200
description:
Simplified runtime command script location querying.
diffstat:
TODO | 5 +-
src/lib-sieve/cmd-discard.c | 13 +--
src/lib-sieve/cmd-keep.c | 12 +--
src/lib-sieve/cmd-redirect.c | 12 +--
src/lib-sieve/ext-fileinto.c | 14 +--
src/lib-sieve/ext-reject.c | 10 +-
src/lib-sieve/plugins/enotify/cmd-notify.c | 13 +--
src/lib-sieve/plugins/enotify/ext-enotify-common.c | 72 ++++++++---------
src/lib-sieve/plugins/enotify/ext-enotify-common.h | 6 +-
src/lib-sieve/plugins/enotify/tst-notify-method-capability.c | 2 +-
src/lib-sieve/plugins/enotify/tst-valid-notify-method.c | 2 +-
src/lib-sieve/plugins/notify/cmd-notify.c | 23 +----
src/lib-sieve/plugins/vacation/cmd-vacation.c | 14 +--
src/lib-sieve/sieve-actions.c | 11 +-
src/lib-sieve/sieve-actions.h | 3 +-
src/lib-sieve/sieve-interpreter.c | 59 ++++++++------
src/lib-sieve/sieve-interpreter.h | 20 ++--
src/lib-sieve/sieve-result.c | 19 ++--
src/lib-sieve/sieve-result.h | 12 +-
src/sieve-tools/debug/cmd-debug-print.c | 17 ++-
src/testsuite/testsuite-result.c | 4 +-
src/testsuite/testsuite-script.c | 4 +-
22 files changed, 154 insertions(+), 193 deletions(-)
diffs (truncated from 968 to 300 lines):
diff -r 47a4f48a51a8 -r 0e80e5a03870 TODO
--- a/TODO Sun Aug 29 11:34:40 2010 +0200
+++ b/TODO Mon Aug 30 02:18:54 2010 +0200
@@ -1,5 +1,7 @@
Current activities:
+* Code cleanup:
+ - Review all FIXMEs
* Improve error handling and logging
- Avoid reporting user-caused errors to the master log.
- Review logging and error handling; add more warning/info/debug messages
@@ -7,9 +9,6 @@
Next (in order of descending priority/precedence):
-* Code cleanup:
- - Review all FIXMEs
-
* ## MAKE A SECOND RELEASE (0.2.x) ##
* Unfinished new extensions:
diff -r 47a4f48a51a8 -r 0e80e5a03870 src/lib-sieve/cmd-discard.c
--- a/src/lib-sieve/cmd-discard.c Sun Aug 29 11:34:40 2010 +0200
+++ b/src/lib-sieve/cmd-discard.c Mon Aug 30 02:18:54 2010 +0200
@@ -102,19 +102,14 @@
*/
static int cmd_discard_operation_execute
-(const struct sieve_runtime_env *renv ATTR_UNUSED,
+(const struct sieve_runtime_env *renv ATTR_UNUSED,
sieve_size_t *address ATTR_UNUSED)
-{
- unsigned int source_line;
-
- /* Source line */
- source_line = sieve_runtime_get_command_location(renv);
-
- sieve_runtime_trace(renv, SIEVE_TRLVL_ACTIONS,
+{
+ sieve_runtime_trace(renv, SIEVE_TRLVL_ACTIONS,
"discard action; cancel implicit keep");
if ( sieve_result_add_action
- (renv, NULL, &act_discard, NULL, source_line, NULL, 0) < 0 )
+ (renv, NULL, &act_discard, NULL, NULL, 0) < 0 )
return SIEVE_EXEC_FAILURE;
return SIEVE_EXEC_OK;
diff -r 47a4f48a51a8 -r 0e80e5a03870 src/lib-sieve/cmd-keep.c
--- a/src/lib-sieve/cmd-keep.c Sun Aug 29 11:34:40 2010 +0200
+++ b/src/lib-sieve/cmd-keep.c Mon Aug 30 02:18:54 2010 +0200
@@ -82,18 +82,14 @@
static int cmd_keep_operation_execute
(const struct sieve_runtime_env *renv, sieve_size_t *address)
-{
+{
struct sieve_side_effects_list *slist = NULL;
- unsigned int source_line;
int ret = 0;
/*
* Read data
*/
- /* Source line */
- source_line = sieve_runtime_get_command_location(renv);
-
/* Optional operands (side effects only) */
if ( sieve_action_opr_optional_read(renv, address, NULL, &ret, &slist) != 0 )
return ret;
@@ -104,12 +100,12 @@
sieve_runtime_trace(renv, SIEVE_TRLVL_ACTIONS,
"keep action; store message in default mailbox");
-
+
/* Add keep action to result.
*/
- if ( sieve_result_add_keep(renv, slist, source_line) < 0 )
+ if ( sieve_result_add_keep(renv, slist) < 0 )
return SIEVE_EXEC_FAILURE;
-
+
return SIEVE_EXEC_OK;
}
diff -r 47a4f48a51a8 -r 0e80e5a03870 src/lib-sieve/cmd-redirect.c
--- a/src/lib-sieve/cmd-redirect.c Sun Aug 29 11:34:40 2010 +0200
+++ b/src/lib-sieve/cmd-redirect.c Mon Aug 30 02:18:54 2010 +0200
@@ -193,7 +193,6 @@
struct sieve_side_effects_list *slist = NULL;
struct act_redirect_context *act;
string_t *redirect;
- unsigned int source_line;
pool_t pool;
int ret;
@@ -201,9 +200,6 @@
* Read data
*/
- /* Source line */
- source_line = sieve_runtime_get_command_location(renv);
-
/* Optional operands (side effects only) */
if ( sieve_action_opr_optional_read(renv, address, NULL, &ret, &slist) != 0 )
return ret;
@@ -225,18 +221,18 @@
sieve_runtime_trace(renv, 0, "forward message to address `%s'",
str_sanitize(str_c(redirect), 80));
}
-
+
/* Add redirect action to the result */
pool = sieve_result_pool(renv->result);
act = p_new(pool, struct act_redirect_context, 1);
act->to_address = p_strdup(pool, str_c(redirect));
-
+
if ( sieve_result_add_action
- (renv, NULL, &act_redirect, slist, source_line, (void *) act,
+ (renv, NULL, &act_redirect, slist, (void *) act,
svinst->max_redirects) < 0 )
return SIEVE_EXEC_FAILURE;
-
+
return SIEVE_EXEC_OK;
}
diff -r 47a4f48a51a8 -r 0e80e5a03870 src/lib-sieve/ext-fileinto.c
--- a/src/lib-sieve/ext-fileinto.c Sun Aug 29 11:34:40 2010 +0200
+++ b/src/lib-sieve/ext-fileinto.c Mon Aug 30 02:18:54 2010 +0200
@@ -155,16 +155,12 @@
struct sieve_side_effects_list *slist = NULL;
string_t *folder;
const char *mailbox;
- unsigned int source_line;
int ret = 0;
-
+
/*
* Read operands
*/
- /* Source line */
- source_line = sieve_runtime_get_command_location(renv);
-
/* Optional operands (side effects only) */
if ( sieve_action_opr_optional_read(renv, address, NULL, &ret, &slist) != 0 )
return ret;
@@ -172,7 +168,7 @@
/* Folder operand */
if ( (ret=sieve_opr_string_read(renv, address, "folder", &folder)) <= 0 )
return ret;
-
+
/*
* Perform operation
*/
@@ -185,10 +181,10 @@
sieve_runtime_trace(renv, 0, "store message in mailbox `%s'",
str_sanitize(mailbox, 80));
}
-
- /* Add action to result */
+
+ /* Add action to result */
if ( sieve_act_store_add_to_result
- (renv, slist, str_c(folder), source_line) < 0 )
+ (renv, slist, str_c(folder)) < 0 )
return SIEVE_EXEC_FAILURE;
return SIEVE_EXEC_OK;
diff -r 47a4f48a51a8 -r 0e80e5a03870 src/lib-sieve/ext-reject.c
--- a/src/lib-sieve/ext-reject.c Sun Aug 29 11:34:40 2010 +0200
+++ b/src/lib-sieve/ext-reject.c Mon Aug 30 02:18:54 2010 +0200
@@ -267,7 +267,6 @@
struct sieve_side_effects_list *slist = NULL;
struct act_reject_context *act;
string_t *reason;
- unsigned int source_line;
pool_t pool;
int ret;
@@ -275,9 +274,6 @@
* Read data
*/
- /* Source line */
- source_line = sieve_runtime_get_command_location(renv);
-
/* Optional operands (side effects only) */
if ( sieve_action_opr_optional_read(renv, address, NULL, &ret, &slist) != 0 )
return ret;
@@ -306,11 +302,11 @@
act = p_new(pool, struct act_reject_context, 1);
act->reason = p_strdup(pool, str_c(reason));
act->ereject = ( sieve_operation_is(oprtn, ereject_operation) );
-
+
if ( sieve_result_add_action
- (renv, this_ext, &act_reject, slist, source_line, (void *) act, 0) < 0 )
+ (renv, this_ext, &act_reject, slist, (void *) act, 0) < 0 )
return SIEVE_EXEC_FAILURE;
-
+
return SIEVE_EXEC_OK;
}
diff -r 47a4f48a51a8 -r 0e80e5a03870 src/lib-sieve/plugins/enotify/cmd-notify.c
--- a/src/lib-sieve/plugins/enotify/cmd-notify.c Sun Aug 29 11:34:40 2010 +0200
+++ b/src/lib-sieve/plugins/enotify/cmd-notify.c Mon Aug 30 02:18:54 2010 +0200
@@ -405,17 +405,12 @@
struct sieve_stringlist *options = NULL;
const struct sieve_enotify_method *method;
string_t *method_uri, *message = NULL, *from = NULL;
- unsigned int source_line;
int ret;
/*
* Read operands
*/
-
- /* Source line */
- source_line = sieve_runtime_get_command_location(renv);
-
/* Optional operands */
for (;;) {
@@ -475,7 +470,7 @@
/* Check operands */
if ( (ret=ext_enotify_runtime_check_operands
- (renv, source_line, method_uri, message, from, options, &method,
+ (renv, method_uri, message, from, options, &method,
&method_context)) > 0 )
{
/* Add notify action to the result */
@@ -489,14 +484,14 @@
act->message = p_strdup(pool, str_c(message));
if ( from != NULL )
act->from = p_strdup(pool, str_c(from));
-
+
if ( sieve_result_add_action
- (renv, this_ext, &act_notify, slist, source_line, (void *) act, 0) < 0 )
+ (renv, this_ext, &act_notify, slist, (void *) act, 0) < 0 )
return SIEVE_EXEC_FAILURE;
return SIEVE_EXEC_OK;
}
-
+
return ret;
}
diff -r 47a4f48a51a8 -r 0e80e5a03870 src/lib-sieve/plugins/enotify/ext-enotify-common.c
--- a/src/lib-sieve/plugins/enotify/ext-enotify-common.c Sun Aug 29 11:34:40 2010 +0200
+++ b/src/lib-sieve/plugins/enotify/ext-enotify-common.c Mon Aug 30 02:18:54 2010 +0200
@@ -472,33 +472,32 @@
*/
bool ext_enotify_runtime_method_validate
-(const struct sieve_runtime_env *renv, unsigned int source_line,
- string_t *method_uri)
+(const struct sieve_runtime_env *renv, string_t *method_uri)
{
const struct sieve_extension *this_ext = renv->oprtn->ext;
const struct sieve_enotify_method *method;
const char *uri = str_c(method_uri);
const char *scheme;
bool result = TRUE;
-
+
/* Get the method */
-
+
if ( (scheme=ext_enotify_uri_scheme_parse(&uri)) == NULL )
return FALSE;
-
+
if ( (method=ext_enotify_method_find(this_ext, scheme)) == NULL )
return FALSE;
-
+
/* Validate the provided URI */
-
+
if ( method->def != NULL && method->def->runtime_check_uri != NULL ) {
- struct sieve_enotify_env nenv;
-
+ struct sieve_enotify_env nenv;
+
memset(&nenv, 0, sizeof(nenv));
nenv.method = method;
nenv.ehandler = sieve_prefix_ehandler_create
- (sieve_interpreter_get_error_handler(renv->interp),
More information about the dovecot-cvs
mailing list