dovecot-sieve-1.1: Informational logging of vacation response ou...

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 9 06:49:16 EEST 2007


details:   http://hg.dovecot.org/dovecot-sieve-1.1/rev/0eb93cd3b462
changeset: 36:0eb93cd3b462
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Sep 09 06:49:13 2007 +0300
description:
Informational logging of vacation response outcome. Based on patch by
<pod at sysdev.oucs.ox.ac.uk>

diffstat:

1 file changed, 16 insertions(+), 11 deletions(-)
src/sieve-cmu.c |   27 ++++++++++++++++-----------

diffs (50 lines):

diff -r 39e2131dc592 -r 0eb93cd3b462 src/sieve-cmu.c
--- a/src/sieve-cmu.c	Wed Aug 15 17:37:37 2007 +0300
+++ b/src/sieve-cmu.c	Sun Sep 09 06:49:13 2007 +0300
@@ -653,23 +653,25 @@ static int autorespond(void *ac,
 static int autorespond(void *ac, 
 		       void *ic __attr_unused__,
 		       void *sc,
-		       void *mc __attr_unused__,
+		       void *mc,
 		       const char **errmsg __attr_unused__)
 {
     sieve_autorespond_context_t *arc = (sieve_autorespond_context_t *) ac;
     script_data_t *sd = (script_data_t *) sc;
-    int ret;
+    sieve_msgdata_t *md = mc;
 
     /* ok, let's see if we've responded before */
-    ret = duplicate_check(arc->hash, SIEVE_HASHLEN,  sd->username) ?
-	    SIEVE_DONE : SIEVE_OK;
-
-    if (ret == SIEVE_OK) {
-	duplicate_mark(arc->hash, SIEVE_HASHLEN, sd->username,
-		       ioloop_time + arc->days * (24 * 60 * 60));
-    }
-
-    return ret;
+    if (duplicate_check(arc->hash, SIEVE_HASHLEN, sd->username)) {
+	i_info("msgid=%s: discarded duplicate vacation response to <%s>",
+	       md->id == NULL ? "" : str_sanitize(md->id, 80),
+	       str_sanitize(md->return_path, 80));
+	return SIEVE_DONE;
+    }
+
+    duplicate_mark(arc->hash, SIEVE_HASHLEN, sd->username,
+                   ioloop_time + arc->days * (24 * 60 * 60));
+
+    return SIEVE_OK;
 }
 
 static int send_response(void *ac, 
@@ -716,6 +718,9 @@ static int send_response(void *ac,
     if (smtp_client_close(smtp_client) == 0) {
         duplicate_mark(outmsgid, strlen(outmsgid),
                        sdata->username, ioloop_time + DUPLICATE_DEFAULT_KEEP);
+	i_info("msgid=%s: sent vacation response to <%s>",
+	       md->id == NULL ? "" : str_sanitize(md->id, 80),
+	       str_sanitize(md->return_path, 80));
 	return SIEVE_OK;
     } else {
 	*errmsg = "Error sending mail";


More information about the dovecot-cvs mailing list