dovecot-2.2-pigeonhole: lib-sieve: variables extension: Added AP...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Wed Jul 30 11:50:58 UTC 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/1a010c4d0a0a
changeset: 1901:1a010c4d0a0a
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Wed Jul 30 13:50:48 2014 +0200
description:
lib-sieve: variables extension: Added API for assigning cstrings to variables.

diffstat:

 src/lib-sieve/plugins/variables/ext-variables-common.c |  19 ++++++++++++++++++
 src/lib-sieve/plugins/variables/sieve-ext-variables.h  |   3 ++
 2 files changed, 22 insertions(+), 0 deletions(-)

diffs (42 lines):

diff -r 2e1350548161 -r 1a010c4d0a0a src/lib-sieve/plugins/variables/ext-variables-common.c
--- a/src/lib-sieve/plugins/variables/ext-variables-common.c	Wed Jul 30 13:50:12 2014 +0200
+++ b/src/lib-sieve/plugins/variables/ext-variables-common.c	Wed Jul 30 13:50:48 2014 +0200
@@ -523,6 +523,25 @@
 	return TRUE;
 }
 
+bool sieve_variable_assign_cstr
+(struct sieve_variable_storage *storage, unsigned int index,
+	const char *value)
+{
+	string_t *varval;
+
+	if ( !sieve_variable_get_modifiable(storage, index, &varval) )
+		return FALSE;
+
+	str_truncate(varval, 0);
+	str_append(varval, value);
+
+	/* Just a precaution, caller should prevent this in the first place */
+	if ( str_len(varval) > EXT_VARIABLES_MAX_VARIABLE_SIZE )
+		str_truncate(varval, EXT_VARIABLES_MAX_VARIABLE_SIZE);
+
+	return TRUE;
+}
+
 /*
  * AST Context
  */
diff -r 2e1350548161 -r 1a010c4d0a0a src/lib-sieve/plugins/variables/sieve-ext-variables.h
--- a/src/lib-sieve/plugins/variables/sieve-ext-variables.h	Wed Jul 30 13:50:12 2014 +0200
+++ b/src/lib-sieve/plugins/variables/sieve-ext-variables.h	Wed Jul 30 13:50:48 2014 +0200
@@ -194,6 +194,9 @@
 bool sieve_variable_assign
 	(struct sieve_variable_storage *storage, unsigned int index,
 		const string_t *value);
+bool sieve_variable_assign_cstr
+	(struct sieve_variable_storage *storage, unsigned int index,
+		const char *value);
 bool sieve_variable_get_identifier
 	(struct sieve_variable_storage *storage, unsigned int index,
 		const char **identifier);


More information about the dovecot-cvs mailing list