From 674599b9fe8f3e304088b2cdc238b22c99eff74d Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Wed, 9 Feb 2011 19:31:36 +0100
Subject: [PATCH] Vacation extension: now inhibits replies to messages from
 sender listed in :addresses.

---
 src/lib-sieve/plugins/vacation/cmd-vacation.c | 25 ++++++++++++++++---
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/lib-sieve/plugins/vacation/cmd-vacation.c b/src/lib-sieve/plugins/vacation/cmd-vacation.c
index 7b734aa14..8e03c1ca1 100644
--- a/src/lib-sieve/plugins/vacation/cmd-vacation.c
+++ b/src/lib-sieve/plugins/vacation/cmd-vacation.c
@@ -1039,13 +1039,30 @@ static bool act_vacation_commit
 	}    
 	
 	/* Are we perhaps trying to respond to ourselves ? 
-	 * (FIXME: verify this to :addresses as well?)
 	 */
-	if ( sieve_address_compare(sender, recipient, TRUE) 
-		== 0 ) {
-		sieve_result_global_log(aenv, "discarded vacation reply to own address");	
+	if ( sieve_address_compare(sender, recipient, TRUE) == 0 ) {
+		sieve_result_global_log(aenv,
+			"discarded vacation reply to own address <%s>",
+			str_sanitize(sender, 128));	
 		return TRUE;
 	}
+
+	/* Are we perhaps trying to respond to one of our alternative :addresses?
+	 */
+	if ( ctx->addresses != NULL ) {
+		const char * const *alt_address = ctx->addresses;
+		
+		while ( *alt_address != NULL ) {
+			if ( sieve_address_compare(sender, *alt_address, TRUE) == 0 ) {
+				sieve_result_global_log(aenv,
+					"discarded vacation reply to own address <%s> "
+					"(as specified using :addresses argument)",
+					str_sanitize(sender, 128));	
+				return TRUE;
+			}
+			alt_address++;
+		}			
+	}
 	
 	/* Did whe respond to this user before? */
 	if ( sieve_action_duplicate_check_available(senv) ) {
-- 
GitLab