dovecot-sieve-1.1: Fixed to compile with new API

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 13 17:01:05 EEST 2007


details:   http://hg.dovecot.org/dovecot-sieve-1.1/rev/0367450c9382
changeset: 34:0367450c9382
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 13 17:01:02 2007 +0300
description:
Fixed to compile with new API

diffstat:

1 file changed, 12 insertions(+), 6 deletions(-)
src/sieve-cmu.c |   18 ++++++++++++------

diffs (58 lines):

diff -r 8f6830cf7b75 -r 0367450c9382 src/sieve-cmu.c
--- a/src/sieve-cmu.c	Thu Aug 09 15:44:31 2007 +0300
+++ b/src/sieve-cmu.c	Mon Aug 13 17:01:02 2007 +0300
@@ -69,9 +69,12 @@ static int getheader(void *v, const char
 static int getheader(void *v, const char *phead, const char ***body)
 {
     sieve_msgdata_t *m = v;
+    const char *const *headers;
 
     if (phead==NULL) return SIEVE_FAIL;
-    *body = (const char **)mail_get_headers_utf8(m->mail, phead);
+    if (mail_get_headers_utf8(m->mail, phead, &headers) < 0)
+	    return SIEVE_FAIL;
+    *body = (const char **)headers;
 
     if (*body) {
 	return SIEVE_OK;
@@ -85,8 +88,7 @@ static int getsize(void *mc, int *size)
     sieve_msgdata_t *md = mc;
     uoff_t psize;
 
-    psize = mail_get_physical_size(md->mail);
-    if (psize == (uoff_t)-1)
+    if (mail_get_physical_size(md->mail, &psize) < 0)
 	    return SIEVE_FAIL;
 
     *size = psize;
@@ -234,6 +236,7 @@ parts_add_missing(sieve_msgdata_t *m, co
 	struct message_parser_ctx *parser;
 	struct message_decoder_context *decoder;
 	struct message_block block, decoded;
+	const struct message_part *const_parts;
 	struct message_part *parts, *prev_part = NULL;
 	struct istream *input;
 	unsigned int idx = 0;
@@ -243,8 +246,11 @@ parts_add_missing(sieve_msgdata_t *m, co
 	if (get_return_body_parts(m, content_types, decode_to_plain))
 		return 0;
 
-	input = mail_get_stream(m->mail, NULL, NULL);
-	parts = (struct message_part *)mail_get_parts(m->mail);
+	if (mail_get_stream(m->mail, NULL, NULL, &input) < 0)
+		return -1;
+	if (mail_get_parts(m->mail, &const_parts) < 0)
+		return -1;
+	parts = (struct message_part *)const_parts;
 
 	buffer_set_used_size(m->tmp_buffer, 0);
 	decoder = decode_to_plain ? message_decoder_init(FALSE) : NULL;
@@ -940,7 +946,7 @@ int cmu_sieve_run(struct mail_namespace 
 	mdata.mail = mail;
 	mdata.mailbox = mailbox;
 	mdata.authuser = username;
-	mdata.id = mail_get_first_header(mail, "Message-ID");
+	(void)mail_get_first_header(mail, "Message-ID", &mdata.id);
 	mdata.return_path = deliver_get_return_address(mail);
 
 	if ((ret = sieve_script_load(compiled_path, &bytecode)) != SIEVE_OK) {


More information about the dovecot-cvs mailing list