dovecot-2.1-pigeonhole: lib-sieve: editheader: fixed normal impl...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Mon Nov 28 09:53:49 EET 2011
details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/f13a2fc82fa0
changeset: 1562:f13a2fc82fa0
user: Stephan Bosch <stephan at rename-it.nl>
date: Mon Nov 28 08:53:43 2011 +0100
description:
lib-sieve: editheader: fixed normal implicit keep.
This was broken by previous change. It now properly uses the final version of the message
instead of the original.
diffstat:
src/lib-sieve/sieve-result.c | 7 ++-
tests/extensions/editheader/addheader.svtest | 46 +++++++++++++++++++++++
tests/extensions/editheader/deleteheader.svtest | 40 +++++++++++++++++++-
3 files changed, 90 insertions(+), 3 deletions(-)
diffs (131 lines):
diff -r 6798ae05aa0a -r f13a2fc82fa0 src/lib-sieve/sieve-result.c
--- a/src/lib-sieve/sieve-result.c Mon Nov 28 00:49:01 2011 +0100
+++ b/src/lib-sieve/sieve-result.c Mon Nov 28 08:53:43 2011 +0100
@@ -912,10 +912,13 @@
void *tr_context = NULL;
struct sieve_action act_keep;
- if ( rollback )
+ if ( rollback ) {
act_keep = result->failure_action;
- else
+ act_keep.mail = NULL;
+ } else {
act_keep = result->keep_action;
+ act_keep.mail = sieve_message_get_mail(result->action_env.msgctx);
+ }
/* If keep is a non-action, return right away */
if ( act_keep.def == NULL ) return TRUE;
diff -r 6798ae05aa0a -r f13a2fc82fa0 tests/extensions/editheader/addheader.svtest
--- a/tests/extensions/editheader/addheader.svtest Mon Nov 28 00:49:01 2011 +0100
+++ b/tests/extensions/editheader/addheader.svtest Mon Nov 28 08:53:43 2011 +0100
@@ -477,5 +477,51 @@
}
}
+test_result_reset;
+test_set "message" "${message}";
+test "Addheader - implicit keep" {
+ if size :over 76 {
+ test_fail "original message is longer than 76 bytes?!";
+ }
+ addheader "X-Some-Header" "Header content";
+
+ if not test_result_execute {
+ test_fail "failed to execute result";
+ }
+
+ if not test_message :folder "INBOX" 0 {
+ test_fail "message not stored";
+ }
+
+ if not size :over 76 {
+ test_fail "stored mail is not larger";
+ }
+
+ if size :over 107 {
+ test_fail "stored mail is too large";
+ }
+
+ if size :under 100 {
+ test_fail "stored mail is too small";
+ }
+
+ if not header :is "subject" "Frop!" {
+ test_fail "original subject header not retained in stored message";
+ }
+
+ if not exists "x-some-header" {
+ test_fail "header not added to stored message";
+ }
+
+ if not header :is "x-some-header" "Header content" {
+ test_fail "wrong content added to stored message";
+ }
+
+ if not body :matches "Frop!*" {
+ test_fail "body not retained in stored mail";
+ }
+}
+
+
diff -r 6798ae05aa0a -r f13a2fc82fa0 tests/extensions/editheader/deleteheader.svtest
--- a/tests/extensions/editheader/deleteheader.svtest Mon Nov 28 00:49:01 2011 +0100
+++ b/tests/extensions/editheader/deleteheader.svtest Mon Nov 28 08:53:43 2011 +0100
@@ -611,6 +611,44 @@
}
test_result_reset;
+test_set "message" "${message}";
+test "Deleteheader - implicit keep" {
+ deleteheader "X-D";
+
+ if not test_result_execute {
+ test_fail "failed to execute result";
+ }
+
+ if not test_message :folder "INBOX" 0 {
+ test_fail "message not stored";
+ }
+
+ if not header :is "subject" "Frop!" {
+ test_fail "original subject header not retained in stored mail";
+ }
+
+ if not header :is "X-B" "omdat dit anders" {
+ test_fail "original X-B header not retained in stored mail";
+ }
+
+ if not header :is "X-C" "niet via e-mail versturen" {
+ test_fail "original X-C header not retained in stored mail";
+ }
+
+ if exists "X-D" {
+ test_fail "X-D header not deleted in stored mail";
+ }
+
+ if not body :matches "Frop!*" {
+ test_fail "body not retained in stored mail";
+ }
+}
+
+/*
+ *
+ */
+
+test_result_reset;
test_set "message" text:
X-A: Dit is een klein verhaaltje
@@ -846,7 +884,7 @@
.
;
-test "Deleteheader - :matches" {
+test "Deleteheader - folded" {
deleteheader "X-A";
if exists "X-A" {
More information about the dovecot-cvs
mailing list