I attach a patch that adds some informational logging for the vacation
outcome in a similar style as the 'notify', 'redirect' and 'reject' cases.

I considered adding logging for the not-willing-to-respond case since I
think that would greatly assist testing/debugging vacation responses, but
couldn't see where to put it that wasn't in the CMU code.
# HG changeset patch
# User <[EMAIL PROTECTED]>
# Date 1187020492 -3600
# Node ID 88b201d37835eb841fba76b9e918857f7236eafa
# Parent  5132f4b25eb08437f22ce2458bfa6b1e4d27ae9c
informational logging of vacation response outcome

diff -r 5132f4b25eb0 -r 88b201d37835 src/sieve-cmu.c
--- a/src/sieve-cmu.c   Tue Aug 07 20:24:57 2007 +0100
+++ 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";

Reply via email to