dovecot-sieve-1.1: Deliver API now passes destination address in...

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 30 17:34:14 EEST 2007


details:   http://hg.dovecot.org/dovecot-sieve-1.1/rev/485f4449e3ae
changeset: 43:485f4449e3ae
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Sep 30 17:33:38 2007 +0300
description:
Deliver API now passes destination address instead of username. Separate
these so that getenvelope("to") returns the address and getenvelope("auth")
returns the username.

diffstat:

3 files changed, 9 insertions(+), 7 deletions(-)
src/cmusieve-plugin.c |    4 ++--
src/cmusieve-plugin.h |    4 ++--
src/sieve-cmu.c       |    8 +++++---

diffs (74 lines):

diff -r 1bb37e36a468 -r 485f4449e3ae src/cmusieve-plugin.c
--- a/src/cmusieve-plugin.c	Sun Sep 30 16:15:34 2007 +0300
+++ b/src/cmusieve-plugin.c	Sun Sep 30 17:33:38 2007 +0300
@@ -62,7 +62,7 @@ cmusieve_deliver_mail(struct mail_namesp
 cmusieve_deliver_mail(struct mail_namespace *namespaces,
 		      struct mail_storage **storage_r,
 		      struct mail *mail,
-		      const char *username, const char *mailbox)
+		      const char *destaddr, const char *mailbox)
 {
 	const char *script_path;
 
@@ -74,7 +74,7 @@ cmusieve_deliver_mail(struct mail_namesp
 		i_info("cmusieve: Using sieve path: %s", script_path);
 
 	return cmu_sieve_run(namespaces, storage_r, mail, script_path,
-			     username, mailbox);
+			     destaddr, getenv("USER"), mailbox);
 }
 
 void cmusieve_plugin_init(void)
diff -r 1bb37e36a468 -r 485f4449e3ae src/cmusieve-plugin.h
--- a/src/cmusieve-plugin.h	Sun Sep 30 16:15:34 2007 +0300
+++ b/src/cmusieve-plugin.h	Sun Sep 30 17:33:38 2007 +0300
@@ -3,8 +3,8 @@
 
 int cmu_sieve_run(struct mail_namespace *namespaces,
 		  struct mail_storage **storage_r, struct mail *mail,
-		  const char *script_path, const char *username,
-		  const char *mailbox);
+		  const char *script_path, const char *destaddr,
+		  const char *username, const char *mailbox);
 
 void cmusieve_plugin_init(void);
 void cmusieve_plugin_deinit(void);
diff -r 1bb37e36a468 -r 485f4449e3ae src/sieve-cmu.c
--- a/src/sieve-cmu.c	Sun Sep 30 16:15:34 2007 +0300
+++ b/src/sieve-cmu.c	Sun Sep 30 17:33:38 2007 +0300
@@ -52,6 +52,7 @@ typedef struct {
 	const char *id;
 	const char *return_path;
 	const char *authuser;
+	const char *destaddr;
 
 	pool_t body_parts_pool;
 	ARRAY_DEFINE(body_parts, struct sieve_body_part);
@@ -113,7 +114,7 @@ static int getenvelope(void *mc, const c
 	return SIEVE_OK;
     } else if (!strcasecmp(field, "to")) {
 	*contents = m->temp;
-	m->temp[0] = /*FIXME:msg_getrcptall(m, m->cur_rcpt)*/m->authuser;
+	m->temp[0] = m->destaddr;
 	m->temp[1] = NULL;
 	return SIEVE_OK;
     } else if (!strcasecmp(field, "auth") && m->authuser) {
@@ -927,8 +928,8 @@ dovecot_sieve_compile(script_data_t *sda
 
 int cmu_sieve_run(struct mail_namespace *namespaces,
 		  struct mail_storage **storage_r, struct mail *mail,
-		  const char *script_path, const char *username,
-		  const char *mailbox)
+		  const char *script_path, const char *destaddr,
+		  const char *username, const char *mailbox)
 {
 	sieve_execute_t *bytecode = NULL;
 	script_data_t sdata;
@@ -951,6 +952,7 @@ int cmu_sieve_run(struct mail_namespace 
 	mdata.mail = mail;
 	mdata.mailbox = mailbox;
 	mdata.authuser = username;
+	mdata.destaddr = destaddr;
 	(void)mail_get_first_header(mail, "Message-ID", &mdata.id);
 	mdata.return_path = deliver_get_return_address(mail);
 


More information about the dovecot-cvs mailing list