diff --git a/src/lib-sieve/plugins/variables/ext-variables-common.c b/src/lib-sieve/plugins/variables/ext-variables-common.c index c2a7a625ac693415e9dea7c7c931c2de8de2ffaa..b2e84b6280a0034219b6cf425d0ab9f58b2b80ac 100644 --- a/src/lib-sieve/plugins/variables/ext-variables-common.c +++ b/src/lib-sieve/plugins/variables/ext-variables-common.c @@ -548,10 +548,14 @@ static bool opr_variable_read_value if ( storage == NULL ) return FALSE; if (sieve_binary_read_integer(renv->sbin, address, &index) ) { - sieve_variable_get(storage, index, str); + /* Parameter str can be NULL if we are requested to only skip and not + * actually read the argument. + */ + if ( str != NULL ) { + sieve_variable_get(storage, index, str); - if ( *str == NULL ) *str = t_str_new(0); - + if ( *str == NULL ) *str = t_str_new(0); + } return TRUE; } @@ -636,14 +640,24 @@ static bool opr_variable_string_read if ( !sieve_binary_read_integer(renv->sbin, address, &elements) ) return FALSE; - *str = t_str_new(128); - for ( i = 0; i < (unsigned int) elements; i++ ) { - string_t *strelm; + /* Parameter str can be NULL if we are requested to only skip and not + * actually read the argument. + */ + if ( str == NULL ) { + for ( i = 0; i < (unsigned int) elements; i++ ) { + if ( !sieve_opr_string_read(renv, address, NULL) ) + return FALSE; + } + } else { + *str = t_str_new(128); + for ( i = 0; i < (unsigned int) elements; i++ ) { + string_t *strelm; - if ( !sieve_opr_string_read(renv, address, &strelm) ) - return FALSE; + if ( !sieve_opr_string_read(renv, address, &strelm) ) + return FALSE; - str_append_str(*str, strelm); + str_append_str(*str, strelm); + } } return TRUE; diff --git a/src/lib-sieve/plugins/variables/variables.sieve b/src/lib-sieve/plugins/variables/variables.sieve index 7f255241de295ee2b5b46ca2b7f4782aa08faca8..8510e4c03628e6772a3ece719c5e783600bffe19 100644 --- a/src/lib-sieve/plugins/variables/variables.sieve +++ b/src/lib-sieve/plugins/variables/variables.sieve @@ -21,8 +21,18 @@ fileinto "${frop}"; fileinto "LEN-${len_frop}"; fileinto "${quote_friep}"; -if string "${foo}" "foosome" { - keep; -} elsif string :comparator "i;ascii-casemap" "${foo}" "foosome" { +set "header" "subject"; +set :lower "hvalue" "moNey"; +set :lower "speed" "very fast"; + +if header :contains "${header}" ["${hvalue}"] { + fileinto "Oeh, het werkt."; +} + +if header :contains "${header}" ["${hvalue} ${speed}"] { + fileinto "Oeh, dit werkt ook."; +} + +if header :comparator "i;ascii-casemap" "${foo}" "foosome" { fileinto "CASE"; } diff --git a/src/lib-sieve/sieve-code.c b/src/lib-sieve/sieve-code.c index dd9c7edec8e3aca29c721a4abb9d85b2a73dd05a..10ddb6b04105dab4f5eff229a1c1d904222ca3f3 100644 --- a/src/lib-sieve/sieve-code.c +++ b/src/lib-sieve/sieve-code.c @@ -540,9 +540,9 @@ struct sieve_coded_stringlist *sieve_opr_stringlist_read const struct sieve_opr_string_interface *intf = (const struct sieve_opr_string_interface *) operand->interface; - if ( intf->read == NULL || !intf->read(renv, address, NULL) ) { - return NULL; - } + if ( intf->read == NULL || !intf->read(renv, address, NULL) ) { + return NULL; + } return sieve_coded_stringlist_create(renv, start, 1, *address); }