-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
message.c: always use the first X-[Original-]Delivered-To header
- Loading branch information
1 parent
7d92853
commit edf24b9
Showing
3 changed files
with
100 additions
and
7 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
cassandane/tiny-tests/Sieve/jmapquery_multiple_deliveredto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!perl | ||
use Cassandane::Tiny; | ||
|
||
sub test_jmapquery_multiple_deliveredto | ||
:min_version_3_3 :needs_component_jmap | ||
{ | ||
my ($self) = @_; | ||
|
||
my $imap = $self->{store}->get_client(); | ||
$imap->create("INBOX.matches") or die; | ||
|
||
$self->{instance}->install_sieve_script(<<'EOF' | ||
require ["x-cyrus-jmapquery", "x-cyrus-log", "variables", "fileinto"]; | ||
if | ||
allof( not string :is "${stop}" "Y", | ||
jmapquery text: | ||
{ | ||
"operator" : "OR", | ||
"conditions" : [ | ||
{ | ||
"deliveredTo" : "[email protected]" | ||
}, | ||
{ | ||
"deliveredTo" : "xxx+*@yyy.zzz" | ||
} | ||
], | ||
"operator" : "OR" | ||
} | ||
. | ||
) | ||
{ | ||
fileinto "INBOX.matches"; | ||
} | ||
EOF | ||
); | ||
|
||
my $body = << 'EOF'; | ||
--047d7b33dd729737fe04d3bde348 | ||
Content-Type: text/plain; charset=UTF-8 | ||
plain | ||
--047d7b33dd729737fe04d3bde348 | ||
Content-Type: image/tiff | ||
Content-Transfer-Encoding: base64 | ||
abc= | ||
--047d7b33dd729737fe04d3bde348-- | ||
EOF | ||
$body =~ s/\r?\n/\r\n/gs; | ||
|
||
xlog $self, "Deliver a matching message"; | ||
my $msg1 = $self->{gen}->generate( | ||
subject => "Message 1", | ||
extra_headers => [['X-Original-Delivered-To', '[email protected]'], | ||
['X-Original-Delivered-To', '[email protected]']], | ||
mime_type => "multipart/mixed", | ||
mime_boundary => "047d7b33dd729737fe04d3bde348", | ||
body => $body, | ||
); | ||
$self->{instance}->deliver($msg1); | ||
|
||
$self->{store}->set_fetch_attributes('uid'); | ||
|
||
xlog "Assert that message got moved into INBOX.matches"; | ||
$self->{store}->set_folder('INBOX.matches'); | ||
$self->check_messages({ 1 => $msg1 }, check_guid => 0); | ||
|
||
xlog $self, "Deliver a non-matching message"; | ||
my $msg2 = $self->{gen}->generate(subject => "Message 2"); | ||
$self->{instance}->deliver($msg2); | ||
$msg2->set_attribute(uid => 1); | ||
|
||
xlog "Assert that message got moved into INBOX"; | ||
$self->{store}->set_folder('INBOX'); | ||
$self->check_messages({ 1 => $msg2 }, check_guid => 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters