[Dovecot] Vacation message with Sieve
Frank Cusack
fcusack at fcusack.com
Wed Dec 2 12:31:12 EET 2009
On November 29, 2009 10:15:55 AM -0800 Frank Cusack <fcusack at fcusack.com>
wrote:
> Easy enough for me to patch the sieve code which is likely what I'll do.
Here it is. I decided to store the timestamp (dup) info even though
it isn't used when deciding to send a response, because
1) it saves the addresses that vacation replies were sent to, so that
when disabling vacation the user can get a report of those recipients
2) if the user changes the vacation :days the dup database already
exists and doesn't have to start fresh -- just like happens if they
change it from (e.g.) :1 to :2
If you want to use this patch, you might want to consider using a
magic number (e.g. 999) for :days instead of 0, so that users unaware
of the magic number can't easily send unthrottled vacation responses.
Just change the
+ if ( ctx->days && senv->duplicate_check != NULL ) {
part to be
+ if ( ctx->days != 999 && senv->duplicate_check != NULL ) {
-frank
-------------- next part --------------
allow vacation :days parameter to be '0', to respond to every single message
--- dovecot-1.2-sieve-0.1.13.orig/src/lib-sieve/plugins/vacation/cmd-vacation.c 2009-08-06 12:43:30.000000000 -0700
+++ dovecot-1.2-sieve-0.1.13/src/lib-sieve/plugins/vacation/cmd-vacation.c 2009-12-01 22:33:50.565468045 -0800
@@ -247,10 +247,12 @@ static bool cmd_vacation_validate_number
return FALSE;
}
+#if 0
/* Enforce :days > 0 */
if ( sieve_ast_argument_number(*arg) == 0 ) {
sieve_ast_argument_number_set(*arg, 1);
}
+#endif
/* Skip parameter */
*arg = sieve_ast_argument_next(*arg);
@@ -585,9 +587,11 @@ static int ext_vacation_operation_execut
return SIEVE_EXEC_BIN_CORRUPT;
}
+#if 0
/* Enforce days > 0 (just to be sure) */
if ( days == 0 )
days = 1;
+#endif
break;
case OPT_SUBJECT:
if ( !sieve_opr_string_read(renv, address, &subject) ) {
@@ -996,7 +1000,7 @@ static bool act_vacation_commit
}
/* Did whe respond to this user before? */
- if ( senv->duplicate_check != NULL ) {
+ if ( ctx->days && senv->duplicate_check != NULL ) {
act_vacation_hash(ctx, sender, dupl_hash);
if ( senv->duplicate_check(dupl_hash, sizeof(dupl_hash), senv->username) )
More information about the dovecot
mailing list