Skip to content
Snippets Groups Projects
Commit 8ff3a4e3 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

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.
parent d4ef9291
No related branches found
No related tags found
No related merge requests found
...@@ -912,10 +912,13 @@ static bool _sieve_result_implicit_keep ...@@ -912,10 +912,13 @@ static bool _sieve_result_implicit_keep
void *tr_context = NULL; void *tr_context = NULL;
struct sieve_action act_keep; struct sieve_action act_keep;
if ( rollback ) if ( rollback ) {
act_keep = result->failure_action; act_keep = result->failure_action;
else act_keep.mail = NULL;
} else {
act_keep = result->keep_action; 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 keep is a non-action, return right away */
if ( act_keep.def == NULL ) return TRUE; if ( act_keep.def == NULL ) return TRUE;
......
...@@ -477,5 +477,51 @@ This is somewhat longer header content ...@@ -477,5 +477,51 @@ This is somewhat longer header content
} }
} }
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";
}
}
...@@ -610,6 +610,44 @@ test "Deleteheader - :index :last" { ...@@ -610,6 +610,44 @@ test "Deleteheader - :index :last" {
} }
} }
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_result_reset;
test_set "message" text: test_set "message" text:
...@@ -846,7 +884,7 @@ Frop! ...@@ -846,7 +884,7 @@ Frop!
. .
; ;
test "Deleteheader - :matches" { test "Deleteheader - folded" {
deleteheader "X-A"; deleteheader "X-A";
if exists "X-A" { if exists "X-A" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.