dovecot-2.0-pigeonhole: lda-sieve: fall back to global recipient...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Sat Sep 17 01:00:13 EEST 2011


details:   http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/296bb15850b4
changeset: 1530:296bb15850b4
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sat Sep 17 00:00:03 2011 +0200
description:
lda-sieve: fall back to global recipient_delimiter setting if plugin/recipient_delimiter is not set.

diffstat:

 src/plugins/lda-sieve/lda-sieve-plugin.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (52 lines):

diff -r 9e0d1a75c546 -r 296bb15850b4 src/plugins/lda-sieve/lda-sieve-plugin.c
--- a/src/plugins/lda-sieve/lda-sieve-plugin.c	Tue Sep 13 22:43:27 2011 +0200
+++ b/src/plugins/lda-sieve/lda-sieve-plugin.c	Sat Sep 17 00:00:03 2011 +0200
@@ -42,13 +42,13 @@
 static const char *lda_sieve_get_homedir
 (void *context)
 {
-	struct mail_user *mail_user = (struct mail_user *) context;
+	struct mail_deliver_context *mdctx = (struct mail_deliver_context *)context;
 	const char *home = NULL;
 
-	if ( mail_user == NULL )
+	if ( mdctx == NULL || mdctx->dest_user == NULL )
 		return NULL;
 
-	if ( mail_user_get_home(mail_user, &home) <= 0 )
+	if ( mail_user_get_home(mdctx->dest_user, &home) <= 0 )
 		return NULL;
 
 	return home;
@@ -57,12 +57,19 @@
 static const char *lda_sieve_get_setting
 (void *context, const char *identifier)
 {
-	struct mail_user *mail_user = (struct mail_user *) context;
+	struct mail_deliver_context *mdctx = (struct mail_deliver_context *)context;
+	const char *value = NULL;
 
-	if ( mail_user == NULL )
+	if ( mdctx == NULL )
 		return NULL;
 
-	return mail_user_plugin_getenv(mail_user, identifier);	
+	if ( mdxtx->dest_user == NULL ||
+		(value=mail_user_plugin_getenv(mail_user, identifier)) == NULL ) {
+		if ( strcmp(identifier, "recipient_delimiter") == 0 )
+			value = mdctx->set->recipient_delimiter;
+	}
+
+	return value;
 }
 
 static const struct sieve_environment lda_sieve_env = {
@@ -665,7 +672,7 @@
 
 	/* Initialize Sieve engine */
 
-	svinst = sieve_init(&lda_sieve_env, mdctx->dest_user, debug);
+	svinst = sieve_init(&lda_sieve_env, mdctx, debug);
 
 	/* Initialize master error handler */
 


More information about the dovecot-cvs mailing list