dovecot-sieve-1.0: informational logging of vacation response ou...

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


details:   http://hg.dovecot.org/dovecot-sieve-1.0/rev/9f9a867501bf
changeset: 30:9f9a867501bf
user:      <pod at sysdev.oucs.ox.ac.uk>
date:      Mon Aug 13 16:54:52 2007 +0100
description:
informational logging of vacation response outcome

diffstat:

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

diffs (50 lines):

diff -r 62bbb51b3e34 -r 9f9a867501bf src/sieve-cmu.c
--- a/src/sieve-cmu.c	Wed Aug 15 17:37:35 2007 +0300
+++ b/src/sieve-cmu.c	Mon Aug 13 16:54:52 2007 +0100
@@ -346,23 +346,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, arc->len,  sd->username) ?
-	    SIEVE_DONE : SIEVE_OK;
-
-    if (ret == SIEVE_OK) {
-	duplicate_mark(arc->hash, arc->len, sd->username,
-		       ioloop_time + arc->days * (24 * 60 * 60));
-    }
-
-    return ret;
+    if (duplicate_check(arc->hash, arc->len,  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, arc->len, sd->username,
+                   ioloop_time + arc->days * (24 * 60 * 60));
+
+    return SIEVE_OK;
 }
 
 static int send_response(void *ac, 
@@ -409,6 +411,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