dovecot-2.2-pigeonhole: Merged changed from Pigeonhole v0.3.

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Thu May 9 16:40:31 EEST 2013


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/39848c052666
changeset: 1763:39848c052666
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Thu May 09 12:21:31 2013 +0200
description:
Merged changed from Pigeonhole v0.3.

diffstat:

 src/lib-sieve/edit-mail.c                           |   4 +++
 src/lib-sieve/plugins/editheader/cmd-deleteheader.c |  10 ++++++-
 tests/extensions/date/basic.svtest                  |  21 ++++++++--------
 tests/extensions/editheader/deleteheader.svtest     |  26 +++++++++++++++++++++
 4 files changed, 48 insertions(+), 13 deletions(-)

diffs (123 lines):

diff -r 676ca33ea4f6 -r 39848c052666 src/lib-sieve/edit-mail.c
--- a/src/lib-sieve/edit-mail.c	Thu May 09 11:28:44 2013 +0200
+++ b/src/lib-sieve/edit-mail.c	Thu May 09 12:21:31 2013 +0200
@@ -558,6 +558,7 @@
 
 	if ( edmail->headers_parsed ) return 1;
 
+	i_stream_seek(edmail->wrapped_stream, 0);
 	hparser = message_parse_header_init
 		(edmail->wrapped_stream, NULL, hparser_flags);
 
@@ -642,6 +643,9 @@
 	message_parse_header_deinit(&hparser);
 
 	if ( ret <= 0 ) {
+		/* blocking i/o required */
+		i_assert( ret != 0 );
+
 		/* Error; clean up */
 		current = head;
 		while ( current != NULL ) {
diff -r 676ca33ea4f6 -r 39848c052666 src/lib-sieve/plugins/editheader/cmd-deleteheader.c
--- a/src/lib-sieve/plugins/editheader/cmd-deleteheader.c	Thu May 09 11:28:44 2013 +0200
+++ b/src/lib-sieve/plugins/editheader/cmd-deleteheader.c	Thu May 09 12:21:31 2013 +0200
@@ -531,9 +531,15 @@
 		/* Delete all occurences of header */
 		ret = edit_mail_header_delete(edmail, str_c(field_name), index);
 
-		if ( trace ) {
-			sieve_runtime_trace(renv, 0, "deleted %d headers", ret);
+		if ( ret < 0 ) {
+			sieve_runtime_warning(renv, NULL, "deleteheader action: "
+				"failed to delete occurences of header `%s' (this should not happen!)",
+				str_c(field_name));
+		} else if ( trace ) {
+			sieve_runtime_trace(renv, 0, "deleted %d occurences of header `%s'",
+				ret, str_c(field_name));
 		}
+
 	}
 
 	return SIEVE_EXEC_OK;
diff -r 676ca33ea4f6 -r 39848c052666 tests/extensions/date/basic.svtest
--- a/tests/extensions/date/basic.svtest	Thu May 09 11:28:44 2013 +0200
+++ b/tests/extensions/date/basic.svtest	Thu May 09 12:21:31 2013 +0200
@@ -41,34 +41,33 @@
 }
 
 test "Comparison" {
-	if not date :is "delivery-date" "date" "2009-07-22" {
-		if date :matches "delivery-date" "date" "*" { set "date" "${1}"; }
+	if not date :originalzone :is "delivery-date" "date" "2009-07-22" {
+		if date :originalzone :matches "delivery-date" "date" "*" { set "date" "${1}"; }
 		test_fail "date is invalid: ${date}";
 	}
-
-	if not date :value "ge" "delivery-date" "date" "2009-07-22" {
+	if not date :originalzone :value "ge" "delivery-date" "date" "2009-07-22" {
 		test_fail "date comparison ge failed equal";
 	}
 
-	if not date :value "ge" "delivery-date" "date" "2009-07-21" {
+	if not date :originalzone :value "ge" "delivery-date" "date" "2009-07-21" {
 		test_fail "date comparison ge failed greater";
 	}
 
-	if anyof (not date :value "ge" "delivery-date" "date" "2009-06-22",
-		not date :value "ge" "date" "date" "2006-07-22" ) {
+	if anyof (not date :originalzone :value "ge" "delivery-date" "date" "2009-06-22",
+		not date :originalzone :value "ge" "date" "date" "2006-07-22" ) {
 		test_fail "date comparison ge failed much greater";
 	}
 
-	if not date :value "le" "delivery-date" "date" "2009-07-22" {
+	if not date :originalzone :value "le" "delivery-date" "date" "2009-07-22" {
 		test_fail "date comparison le failed equal";
 	}
 
-	if not date :value "le" "delivery-date" "date" "2009-07-23" {
+	if not date :originalzone :value "le" "delivery-date" "date" "2009-07-23" {
 		test_fail "date comparison le failed less";
 	}
 
-	if anyof (not date :value "le" "delivery-date" "date" "2009-09-22",
-		not date :value "le" "date" "date" "2012-07-22" ) {
+	if anyof (not date :originalzone :value "le" "delivery-date" "date" "2009-09-22",
+		not date :originalzone :value "le" "date" "date" "2012-07-22" ) {
 		test_fail "date comparison ge failed much less";
 	}
 }
diff -r 676ca33ea4f6 -r 39848c052666 tests/extensions/editheader/deleteheader.svtest
--- a/tests/extensions/editheader/deleteheader.svtest	Thu May 09 11:28:44 2013 +0200
+++ b/tests/extensions/editheader/deleteheader.svtest	Thu May 09 12:21:31 2013 +0200
@@ -962,3 +962,29 @@
 		test_fail "x-b header not deleted";
 	}
 }
+
+/*
+ * TEST: Interaction with body test
+ */
+
+test_set "message" text:
+From: stephan at example.org
+To: nico at frop.example.com
+Subject: Hoppa
+
+Text
+.
+;
+
+test "Interaction with body test" {
+	addheader "X-Frop" "frop";
+	
+	if body "!TEST!" {}
+
+	deleteheader "subject";
+
+	if exists "subject" {
+		test_fail "subject header not deleted";
+	}
+}
+


More information about the dovecot-cvs mailing list