commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. release-2.2-736-g05abf25


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-736-g05abf25
Date: Mon, 26 Oct 2015 06:41:16 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=05abf2570ef2d796a3178fab9298bf2b8868a972

The branch, master has been updated
       via  05abf2570ef2d796a3178fab9298bf2b8868a972 (commit)
      from  9a908ba5a87216d24112e36f7f9c7ffbc6dd53a3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 05abf2570ef2d796a3178fab9298bf2b8868a972
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Oct 26 08:32:16 2015 +0200

    Vacation: improve compatibility with the Sendmail utility.
    
    * libmu_sieve/extensions/vacation.c (match_addresses): Change arguments:
    take primary email address as well as a list of aliases.
    (vacation_reply): Reply if the primary email or one of alias emails are
    listed in recipient list of the original message.  New tag "always_reply"
    reverts to the old behavior: reply regardless of whether the message is
    destined for us.
    Use the current user email as the sender address of the vacation message.
    New tag "return_address" sets the sender address explicitly.
    * sieve/tests/vacation.at: Add new tests.

-----------------------------------------------------------------------

Summary of changes:
 libmu_sieve/extensions/vacation.c |   46 ++++++++++++----
 sieve/tests/vacation.at           |  109 +++++++++++++++++++++++++++++++------
 2 files changed, 127 insertions(+), 28 deletions(-)

diff --git a/libmu_sieve/extensions/vacation.c 
b/libmu_sieve/extensions/vacation.c
index 067e772..2e112a8 100644
--- a/libmu_sieve/extensions/vacation.c
+++ b/libmu_sieve/extensions/vacation.c
@@ -26,6 +26,8 @@
                    [:database <path: string>]
                    [:file]
                    [:mime]
+                   [:always_reply]
+                   [:return_address <email: string>]
                    <reply: string>
 */
 
@@ -162,8 +164,8 @@ _compare (void *item, void *data)
    of the originating mail. Return non-zero if so and store a pointer
    to the matching address in *MY_ADDRESS. */
 static int
-match_addresses (mu_header_t hdr, mu_sieve_value_t *addresses,
-                char **my_address)
+match_addresses (mu_header_t hdr, char *email, mu_sieve_value_t *addresses,
+                char const **my_address)
 {
   int match = 0;
   const char *str;
@@ -174,7 +176,10 @@ match_addresses (mu_header_t hdr, mu_sieve_value_t 
*addresses,
     {
       if (!mu_address_create (&ad.addr, str))
        {
-         match += mu_sieve_vlist_do (addresses, _compare, &ad);
+         if (_compare (email, &ad))
+           match = 1;
+         else if (addresses)
+           match += mu_sieve_vlist_do (addresses, _compare, &ad);
          mu_address_destroy (&ad.addr);
        }
     }
@@ -183,7 +188,10 @@ match_addresses (mu_header_t hdr, mu_sieve_value_t 
*addresses,
     {
       if (!mu_address_create (&ad.addr, str))
        {
-         match += mu_sieve_vlist_do (addresses, _compare, &ad);
+         if (_compare (email, &ad))
+           match = 1;
+         else if (addresses)
+           match += mu_sieve_vlist_do (addresses, _compare, &ad);
          mu_address_destroy (&ad.addr);
        }
     }
@@ -528,7 +536,7 @@ vacation_subject (mu_sieve_machine_t mach, mu_list_t tags,
 /* Generate and send the reply message */
 static int
 vacation_reply (mu_sieve_machine_t mach, mu_list_t tags, mu_message_t msg,
-               char *text, char *to, char *from)
+               char const *text, char const *to, char const *from)
 {
   mu_mime_t mime = NULL;
   mu_message_t newmsg;
@@ -629,10 +637,11 @@ sieve_action_vacation (mu_sieve_machine_t mach, mu_list_t 
args, mu_list_t tags)
 {
   int rc;
   char *text, *from;
+  char const *return_address;
   mu_sieve_value_t *val;
   mu_message_t msg;
   mu_header_t hdr;
-  char *my_address = mu_sieve_get_daemon_email (mach);
+  char *my_address;
   
   if (diag (mach))
     return 0;
@@ -669,20 +678,35 @@ sieve_action_vacation (mu_sieve_machine_t mach, mu_list_t 
args, mu_list_t tags)
       mu_sieve_abort (mach);
     }
 
-  if (mu_sieve_tag_lookup (tags, "aliases", &val)
-      && match_addresses (hdr, val, &my_address) == 0)
-    return 0;
+  my_address = mu_get_user_email (NULL);
+  if (mu_sieve_tag_lookup (tags, "always_reply", NULL))
+    return_address = my_address;
+  else
+    {
+      val = NULL;
+      mu_sieve_tag_lookup (tags, "aliases", &val);
+      if (match_addresses (hdr, my_address, val, &return_address) == 0)
+       {
+         free (my_address);
+         return 0;
+       }
+    }
 
   if (noreply_address_p (mach, tags, from)
       || bulk_precedence_p (hdr)
       || check_db (mach, tags, from))
     {
       free (from);
+      free (my_address);
       return 0;
     }
 
-  rc = vacation_reply (mach, tags, msg, text, from, my_address);
+  if (mu_sieve_tag_lookup (tags, "return_address", &val))
+    return_address = val->v.string;
+
+  rc = vacation_reply (mach, tags, msg, text, from, return_address);
   free (from);
+  free (my_address);
   if (rc == -1)
     mu_sieve_abort (mach);
   return rc;
@@ -700,6 +724,8 @@ static mu_sieve_tag_def_t vacation_tags[] = {
   {"database", SVT_STRING},
   {"mime", SVT_VOID},
   {"file", SVT_VOID},
+  {"always_reply", SVT_VOID},
+  {"return_address", SVT_STRING},
   {NULL}
 };
 
diff --git a/sieve/tests/vacation.at b/sieve/tests/vacation.at
index 525bd1b..e3f259c 100644
--- a/sieve/tests/vacation.at
+++ b/sieve/tests/vacation.at
@@ -29,7 +29,38 @@ export MTA_DIAG MTA_APPEND
 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
 cat ./mta.diag
 ],
-[ENVELOPE FROM: address@hidden
+[ENVELOPE FROM: address@hidden
+ENVELOPE TO: <address@hidden>
+   0: References: <address@hidden>
+   1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
+   2:  <address@hidden>
+   3: Subject: =?UTF-8?Q?Re:_Coffee?=
+   4: To: address@hidden
+   5: Content-Transfer-Encoding: 8bit
+   6: Content-Type: text/plain;charset=UTF-8
+   7: MIME-Version: 1.0
+   8:
+   9: I'm on vacation
+END OF MESSAGE
+],
+[VACATION on msg uid 1
+VACATION on msg uid 2
+VACATION on msg uid 3
+])
+
+MUT_SIEVE_EXT_TEST([aliases],[vac01],
+[require "vacation";
+
+vacation :database "vacation.db" :aliases [[ "address@hidden" ]] "I'm on 
vacation";
+],
+[MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
+MTA_DIAG=`pwd`/mta.diag
+MTA_APPEND=1
+export MTA_DIAG MTA_APPEND
+sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
+cat ./mta.diag
+],
+[ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
    1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
@@ -40,7 +71,49 @@ ENVELOPE TO: <address@hidden>
    6:
    7: I'm on vacation
 END OF MESSAGE
-ENVELOPE FROM: address@hidden
+ENVELOPE FROM: address@hidden
+ENVELOPE TO: <address@hidden>
+   0: References: <address@hidden>
+   1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
+   2:  <address@hidden>
+   3: Subject: =?UTF-8?Q?Re:_Coffee?=
+   4: To: address@hidden
+   5: Content-Transfer-Encoding: 8bit
+   6: Content-Type: text/plain;charset=UTF-8
+   7: MIME-Version: 1.0
+   8:
+   9: I'm on vacation
+END OF MESSAGE
+],
+[VACATION on msg uid 1
+VACATION on msg uid 2
+VACATION on msg uid 3
+])
+
+MUT_SIEVE_EXT_TEST([always_reply],[vac02],
+[require "vacation";
+
+vacation :database "vacation.db" :always_reply "I'm on vacation";
+],
+[MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
+MTA_DIAG=`pwd`/mta.diag
+MTA_APPEND=1
+export MTA_DIAG MTA_APPEND
+sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
+cat ./mta.diag
+],
+[ENVELOPE FROM: address@hidden
+ENVELOPE TO: <address@hidden>
+   0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
+   1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
+   2: To: address@hidden
+   3: Content-Transfer-Encoding: 8bit
+   4: Content-Type: text/plain;charset=UTF-8
+   5: MIME-Version: 1.0
+   6:
+   7: I'm on vacation
+END OF MESSAGE
+ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: In-Reply-To: Your message of TBD
    1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
@@ -51,7 +124,7 @@ ENVELOPE TO: <address@hidden>
    6:
    7: I'm on vacation
 END OF MESSAGE
-ENVELOPE FROM: address@hidden
+ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: References: <address@hidden>
    1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
@@ -70,10 +143,10 @@ VACATION on msg uid 2
 VACATION on msg uid 3
 ])
 
-MUT_SIEVE_EXT_TEST([database matching],[vac01],
+MUT_SIEVE_EXT_TEST([database matching],[vac03],
 [require "vacation";
 
-vacation :database "vacation.db" "I'm on vacation";
+vacation :database "vacation.db" :always_reply "I'm on vacation";
 ],
 [MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
 MTA_DIAG=`pwd`/mta.diag
@@ -83,7 +156,7 @@ sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog 
|| exit 1
 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
 cat ./mta.diag
 ],
-[ENVELOPE FROM: address@hidden
+[ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
    1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
@@ -94,7 +167,7 @@ ENVELOPE TO: <address@hidden>
    6:
    7: I'm on vacation
 END OF MESSAGE
-ENVELOPE FROM: address@hidden
+ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: In-Reply-To: Your message of TBD
    1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
@@ -105,7 +178,7 @@ ENVELOPE TO: <address@hidden>
    6:
    7: I'm on vacation
 END OF MESSAGE
-ENVELOPE FROM: address@hidden
+ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: References: <address@hidden>
    1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
@@ -127,10 +200,10 @@ VACATION on msg uid 2
 VACATION on msg uid 3
 ])
 
-MUT_SIEVE_EXT_TEST([mime],[vac02],
+MUT_SIEVE_EXT_TEST([mime],[vac04],
 [require "vacation";
 
-vacation :database "vacation.db" :mime "I'm on vacation.";
+vacation :database "vacation.db" :always_reply :mime "I'm on vacation.";
 ],
 [MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
 MTA_DIAG=`pwd`/mta.diag
@@ -139,7 +212,7 @@ export MTA_DIAG MTA_APPEND
 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
 cat ./mta.diag
 ],
-[ENVELOPE FROM: address@hidden
+[ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
    1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
@@ -150,7 +223,7 @@ ENVELOPE TO: <address@hidden>
    6:
    7: SSdtIG9uIHZhY2F0aW9uLg==
 END OF MESSAGE
-ENVELOPE FROM: address@hidden
+ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: In-Reply-To: Your message of TBD
    1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
@@ -161,7 +234,7 @@ ENVELOPE TO: <address@hidden>
    6:
    7: SSdtIG9uIHZhY2F0aW9uLg==
 END OF MESSAGE
-ENVELOPE FROM: address@hidden
+ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: References: <address@hidden>
    1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
@@ -180,10 +253,10 @@ VACATION on msg uid 2
 VACATION on msg uid 3
 ])
 
-MUT_SIEVE_EXT_TEST([reply from file],[vac03],
+MUT_SIEVE_EXT_TEST([reply from file],[vac05],
 [require "vacation";
 
-vacation :database "vacation.db" :file "reply";
+vacation :database "vacation.db" :always_reply :file "reply";
 ],
 [AT_DATA([reply],[X-Mail-Processor: sieve
 
@@ -200,7 +273,7 @@ export MTA_DIAG MTA_APPEND
 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
 cat ./mta.diag
 ],
-[ENVELOPE FROM: address@hidden
+[ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
    1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
@@ -213,7 +286,7 @@ ENVELOPE TO: <address@hidden>
    8: Best regards,
    9: Ty Coon
 END OF MESSAGE
-ENVELOPE FROM: address@hidden
+ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: In-Reply-To: Your message of TBD
    1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
@@ -226,7 +299,7 @@ ENVELOPE TO: <address@hidden>
    8: Best regards,
    9: Ty Coon
 END OF MESSAGE
-ENVELOPE FROM: address@hidden
+ENVELOPE FROM: address@hidden
 ENVELOPE TO: <address@hidden>
    0: References: <address@hidden>
    1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200


hooks/post-receive
-- 
GNU Mailutils



reply via email to

[Prev in Thread] Current Thread [Next in Thread]