diff --git a/CHANGELOG b/CHANGELOG index a27c32dc3..b0a8a67ec 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,7 @@ CHANGELOG Roundcube Webmail - Elastic: Fix folders list scrolling on touch devices (#6706) - Elastic: Fix non-working pretty selects in Chrome browser (#6705) - Managesieve: Fix bug where global includes were requested for vacation (#6716) +- Managesieve: Use RFC-compliant line endings, CRLF instead of LF (#6686) - Fix bug in HTML parser that could cause missing text fragments when there was no head/body tag (#6713) - Fix bug where HTML messages with a xml:namespace tag were not rendered (#6697) - Fix TinyMCE download location (#6694) diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index 97a5ad117..d294888d9 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -1,3 +1,4 @@ +- Use RFC-compliant line endings, CRLF instead of LF (#6686) - Fix bug where global includes were requested for vacation (#6716) * version 9.2 [2018-11-08] diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php index 4d8a72c08..4b70b5ee7 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php @@ -196,14 +196,14 @@ class rcube_sieve_script foreach ($this->vars as $var) { if (empty($has_vars)) { // 'variables' extension not supported, put vars in comments - $output .= sprintf("# %s %s\n", $var['name'], $var['value']); + $output .= sprintf("# %s %s\r\n", $var['name'], $var['value']); } else { $output .= 'set '; foreach (array_diff(array_keys($var), array('name', 'value')) as $opt) { $output .= ":$opt "; } - $output .= self::escape_string($var['name']) . ' ' . self::escape_string($var['value']) . ";\n"; + $output .= self::escape_string($var['name']) . ' ' . self::escape_string($var['value']) . ";\r\n"; } } } @@ -219,7 +219,7 @@ class rcube_sieve_script // header if (!empty($rule['name']) && strlen($rule['name'])) { - $script .= '# rule:[' . $rule['name'] . "]\n"; + $script .= '# rule:[' . $rule['name'] . "]\r\n"; } // constraints expressions @@ -379,7 +379,7 @@ class rcube_sieve_script else { $script .= $tests_str; } - $script .= "\n{\n"; + $script .= "\r\n{\r\n"; } // action(s) @@ -548,13 +548,13 @@ class rcube_sieve_script if ($action_script) { $script .= !empty($tests) ? "\t" : ''; - $script .= $action_script . ";\n"; + $script .= $action_script . ";\r\n"; } } } if ($script) { - $output .= $script . (!empty($tests) ? "}\n" : ''); + $output .= $script . (!empty($tests) ? "}\r\n" : ''); $idx++; } } @@ -569,11 +569,11 @@ class rcube_sieve_script sort($exts); // for convenience use always the same order - $output = 'require ["' . implode('","', $exts) . "\"];\n" . $output; + $output = 'require ["' . implode('","', $exts) . "\"];\r\n" . $output; } if (!empty($this->prefix)) { - $output = $this->prefix . "\n\n" . $output; + $output = $this->prefix . "\r\n\r\n" . $output; } return $output; @@ -678,7 +678,7 @@ class rcube_sieve_script } if (!empty($prefix)) { - $this->prefix = trim($prefix); + $this->prefix = trim(preg_replace('/\r?\n/', "\r\n", $prefix)); } } @@ -1203,7 +1203,7 @@ class rcube_sieve_script // multi-line string if (preg_match('/[\r\n\0]/', $str)) { - return sprintf("text:\n%s\n.\n", self::escape_multiline_string($str)); + return sprintf("text:\r\n%s\r\n.\r\n", self::escape_multiline_string($str)); } // quoted-string else { @@ -1394,7 +1394,7 @@ class rcube_sieve_script // remove dot-stuffing $text = str_replace("\n..", "\n.", $text); - $result[] = $text; + $result[] = rtrim($text, "\r\n"); $position++; } } diff --git a/plugins/managesieve/tests/Tokenizer.php b/plugins/managesieve/tests/Tokenizer.php index f50ed75b7..f40901594 100644 --- a/plugins/managesieve/tests/Tokenizer.php +++ b/plugins/managesieve/tests/Tokenizer.php @@ -12,11 +12,13 @@ class Tokenizer extends PHPUnit_Framework_TestCase { return array( array(1, "text: #test\nThis is test ; message;\nMulti line\n.\n;\n", '"This is test ; message;\nMulti line"'), + array(1, "text: #test\r\nThis is test ; message;\nMulti line\r\n.\r\n;", '"This is test ; message;\nMulti line"'), array(0, '["test1","test2"]', '[["test1","test2"]]'), array(1, '["test"]', '["test"]'), array(1, '"te\\"st"', '"te\\"st"'), array(0, 'test #comment', '["test"]'), array(0, "text:\ntest\n.\ntext:\ntest\n.\n", '["test","test"]'), + array(0, "text:\r\ntest\r\n.\r\ntext:\r\ntest\r\n.\r\n", '["test","test"]'), array(1, '"\\a\\\\\\"a"', '"a\\\\\\"a"'), ); } diff --git a/plugins/managesieve/tests/Vacation.php b/plugins/managesieve/tests/Vacation.php index 942525c2f..81587cf10 100644 --- a/plugins/managesieve/tests/Vacation.php +++ b/plugins/managesieve/tests/Vacation.php @@ -63,4 +63,3 @@ class Managesieve_Vacation extends PHPUnit_Framework_TestCase $this->assertSame('05 Mar 2014', $result['to']); } } - diff --git a/plugins/managesieve/tests/src/parser.out b/plugins/managesieve/tests/src/parser.out index 45712d036..a667f1b28 100644 --- a/plugins/managesieve/tests/src/parser.out +++ b/plugins/managesieve/tests/src/parser.out @@ -1,58 +1,58 @@ -require ["envelope","fileinto","reject"]; -# rule:[spam] -if header :contains "X-DSPAM-Result" "Spam" -{ - fileinto "Spam"; - stop; -} -# rule:[test1] -if header :contains ["From","To"] "test@domain.tld" -{ - discard; - stop; -} -# rule:[test2] -if anyof (not header :contains :comparator "i;octet" "Subject" "[test]", header :contains "Subject" "[test2]") -{ - fileinto "test"; - stop; -} -# rule:[comments] -if true -{ - stop; -} -# rule:[reject] -if size :over 5000K -{ - reject "Message over 5MB size limit. Please contact me before sending this."; -} -# rule:[false] -if false # size :over 5000K -{ - stop; -} -# rule:[true] -if true -{ - stop; -} -fileinto "Test"; -# rule:[address test] -if address :is "From" "nagios@domain.tld" -{ - fileinto "domain.tld"; - stop; -} -# rule:[envelope test] -if envelope :domain :is "From" "domain.tld" -{ - fileinto "domain.tld"; - stop; -} -# rule:[do not wrap long lines] -if envelope :domain :is "From" "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" -{ - fileinto "domain.tld"; - stop; -} +require ["envelope","fileinto","reject"]; +# rule:[spam] +if header :contains "X-DSPAM-Result" "Spam" +{ + fileinto "Spam"; + stop; +} +# rule:[test1] +if header :contains ["From","To"] "test@domain.tld" +{ + discard; + stop; +} +# rule:[test2] +if anyof (not header :contains :comparator "i;octet" "Subject" "[test]", header :contains "Subject" "[test2]") +{ + fileinto "test"; + stop; +} +# rule:[comments] +if true +{ + stop; +} +# rule:[reject] +if size :over 5000K +{ + reject "Message over 5MB size limit. Please contact me before sending this."; +} +# rule:[false] +if false # size :over 5000K +{ + stop; +} +# rule:[true] +if true +{ + stop; +} +fileinto "Test"; +# rule:[address test] +if address :is "From" "nagios@domain.tld" +{ + fileinto "domain.tld"; + stop; +} +# rule:[envelope test] +if envelope :domain :is "From" "domain.tld" +{ + fileinto "domain.tld"; + stop; +} +# rule:[do not wrap long lines] +if envelope :domain :is "From" "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +{ + fileinto "domain.tld"; + stop; +} diff --git a/plugins/managesieve/tests/src/parser_body b/plugins/managesieve/tests/src/parser_body index bd142ed8c..504d5c4f2 100644 --- a/plugins/managesieve/tests/src/parser_body +++ b/plugins/managesieve/tests/src/parser_body @@ -1,17 +1,17 @@ -require ["body","fileinto"]; -if body :raw :contains "MAKE MONEY FAST" -{ - stop; -} -if body :content "text" :contains ["missile","coordinates"] -{ - fileinto "secrets"; -} -if body :content "audio/mp3" :contains "" -{ - fileinto "jukebox"; -} -if body :text :contains "project schedule" -{ - fileinto "project/schedule"; -} +require ["body","fileinto"]; +if body :raw :contains "MAKE MONEY FAST" +{ + stop; +} +if body :content "text" :contains ["missile","coordinates"] +{ + fileinto "secrets"; +} +if body :content "audio/mp3" :contains "" +{ + fileinto "jukebox"; +} +if body :text :contains "project schedule" +{ + fileinto "project/schedule"; +} diff --git a/plugins/managesieve/tests/src/parser_comments.out b/plugins/managesieve/tests/src/parser_comments.out index 677783622..2c2d7e16b 100644 --- a/plugins/managesieve/tests/src/parser_comments.out +++ b/plugins/managesieve/tests/src/parser_comments.out @@ -1,10 +1,10 @@ -require ["envelope","fileinto","imap4flags","subaddress"]; -if envelope :detail "to" "addressextension" -{ - setflag "\\Flagged"; -} -if header :is "X-Spam-Flag" "YES" -{ - fileinto "Junk"; - stop; -} +require ["envelope","fileinto","imap4flags","subaddress"]; +if envelope :detail "to" "addressextension" +{ + setflag "\\Flagged"; +} +if header :is "X-Spam-Flag" "YES" +{ + fileinto "Junk"; + stop; +} diff --git a/plugins/managesieve/tests/src/parser_date b/plugins/managesieve/tests/src/parser_date index 06b00333f..9d33e75f2 100644 --- a/plugins/managesieve/tests/src/parser_date +++ b/plugins/managesieve/tests/src/parser_date @@ -1,21 +1,21 @@ -require ["comparator-i;ascii-numeric","date","fileinto","relational"]; -# rule:[date] -if allof (date :originalzone :value "ge" :comparator "i;ascii-numeric" "date" "hour" "09") -{ - fileinto "urgent"; -} -# rule:[date-weekday] -if date :is "received" "weekday" "0" -{ - fileinto "weekend"; -} -# rule:[date-zone] -if date :zone "-0500" :value "gt" :comparator "i;ascii-numeric" "received" "iso8601" "2007-02-26T09:00:00-05:00" -{ - stop; -} -# rule:[currentdate] -if anyof (currentdate :is "weekday" "0", currentdate :value "lt" :comparator "i;ascii-numeric" "hour" "09", currentdate :value "ge" :comparator "i;ascii-numeric" "date" "2007-06-30") -{ - stop; -} +require ["comparator-i;ascii-numeric","date","fileinto","relational"]; +# rule:[date] +if allof (date :originalzone :value "ge" :comparator "i;ascii-numeric" "date" "hour" "09") +{ + fileinto "urgent"; +} +# rule:[date-weekday] +if date :is "received" "weekday" "0" +{ + fileinto "weekend"; +} +# rule:[date-zone] +if date :zone "-0500" :value "gt" :comparator "i;ascii-numeric" "received" "iso8601" "2007-02-26T09:00:00-05:00" +{ + stop; +} +# rule:[currentdate] +if anyof (currentdate :is "weekday" "0", currentdate :value "lt" :comparator "i;ascii-numeric" "hour" "09", currentdate :value "ge" :comparator "i;ascii-numeric" "date" "2007-06-30") +{ + stop; +} diff --git a/plugins/managesieve/tests/src/parser_duplicate b/plugins/managesieve/tests/src/parser_duplicate index 4d10d772c..199024cd7 100644 --- a/plugins/managesieve/tests/src/parser_duplicate +++ b/plugins/managesieve/tests/src/parser_duplicate @@ -1,16 +1,16 @@ -require ["duplicate","fileinto"]; -# rule:[test-duplicate] -if duplicate -{ - fileinto "urgent"; -} -# rule:[test-duplicate-2] -if allof (duplicate :handle "support" :header "X-Ticket-ID", header :contains "subject" "fileserver") -{ - fileinto "test"; -} -# rule:[test-duplicate-3] -if not duplicate :uniqueid "test" :seconds 1800 -{ - discard; -} +require ["duplicate","fileinto"]; +# rule:[test-duplicate] +if duplicate +{ + fileinto "urgent"; +} +# rule:[test-duplicate-2] +if allof (duplicate :handle "support" :header "X-Ticket-ID", header :contains "subject" "fileserver") +{ + fileinto "test"; +} +# rule:[test-duplicate-3] +if not duplicate :uniqueid "test" :seconds 1800 +{ + discard; +} diff --git a/plugins/managesieve/tests/src/parser_editheader b/plugins/managesieve/tests/src/parser_editheader index ed713a53e..f9638a605 100644 --- a/plugins/managesieve/tests/src/parser_editheader +++ b/plugins/managesieve/tests/src/parser_editheader @@ -1,36 +1,36 @@ -require ["editheader"]; -# rule:[test-addheader1] -if true -{ - addheader "X-Sieve-Filtered" ""; -} -# rule:[test-addheader2] -if not header :contains "X-Sieve-Filtered" "" -{ - addheader :last "X-Sieve-Filtered" ""; -} -# rule:[test-deleteheader1] -if true -{ - deleteheader :index 1 :contains "Delivered-To" ["bob@example.com","test@test.com"]; -} -# rule:[test-deleteheader2] -if true -{ - deleteheader :index 2 :last :contains :comparator "i;octet" "Delivered-To" "test@test.com"; -} -# rule:[test-deleteheader3] -if true -{ - deleteheader "Delivered-To"; -} -# rule:[test-deleteheader4] -if true -{ - deleteheader :index 3 :last :contains "Delivered-To"; -} -# rule:[test-deleteheader5] -if true -{ - deleteheader "Delivered-To" "test"; -} +require ["editheader"]; +# rule:[test-addheader1] +if true +{ + addheader "X-Sieve-Filtered" ""; +} +# rule:[test-addheader2] +if not header :contains "X-Sieve-Filtered" "" +{ + addheader :last "X-Sieve-Filtered" ""; +} +# rule:[test-deleteheader1] +if true +{ + deleteheader :index 1 :contains "Delivered-To" ["bob@example.com","test@test.com"]; +} +# rule:[test-deleteheader2] +if true +{ + deleteheader :index 2 :last :contains :comparator "i;octet" "Delivered-To" "test@test.com"; +} +# rule:[test-deleteheader3] +if true +{ + deleteheader "Delivered-To"; +} +# rule:[test-deleteheader4] +if true +{ + deleteheader :index 3 :last :contains "Delivered-To"; +} +# rule:[test-deleteheader5] +if true +{ + deleteheader "Delivered-To" "test"; +} diff --git a/plugins/managesieve/tests/src/parser_enotify_a b/plugins/managesieve/tests/src/parser_enotify_a index 68a9ef5cc..e61ea45f2 100644 --- a/plugins/managesieve/tests/src/parser_enotify_a +++ b/plugins/managesieve/tests/src/parser_enotify_a @@ -1,19 +1,18 @@ -require ["enotify","variables"]; -# rule:[notify1] -if header :contains "from" "boss@example.org" -{ - notify :importance "1" :message "This is probably very important" "mailto:alm@example.com"; - stop; -} -# rule:[subject] -if header :matches "Subject" "*" -{ - set "subject" "${1}"; -} -# rule:[from notify2] -if header :matches "From" "*" -{ - set "from" "${1}"; - notify :importance "3" :message "${from}: ${subject}" "mailto:alm@example.com"; -} - +require ["enotify","variables"]; +# rule:[notify1] +if header :contains "from" "boss@example.org" +{ + notify :importance "1" :message "This is probably very important" "mailto:alm@example.com"; + stop; +} +# rule:[subject] +if header :matches "Subject" "*" +{ + set "subject" "${1}"; +} +# rule:[from notify2] +if header :matches "From" "*" +{ + set "from" "${1}"; + notify :importance "3" :message "${from}: ${subject}" "mailto:alm@example.com"; +} diff --git a/plugins/managesieve/tests/src/parser_enotify_b b/plugins/managesieve/tests/src/parser_enotify_b index a3011bac2..eb3c84749 100644 --- a/plugins/managesieve/tests/src/parser_enotify_b +++ b/plugins/managesieve/tests/src/parser_enotify_b @@ -1,18 +1,18 @@ -require ["enotify","envelope","variables"]; -# rule:[from] -if envelope :matches "from" "*" -{ - set "env_from" " [really: ${1}]"; -} -# rule:[subject] -if header :matches "Subject" "*" -{ - set "subject" "${1}"; -} -# rule:[from notify] -if address :matches "from" "*" -{ - set "from_addr" "${1}"; - notify :message "${from_addr}${env_from}: ${subject}" "mailto:alm@example.com"; -} +require ["enotify","envelope","variables"]; +# rule:[from] +if envelope :matches "from" "*" +{ + set "env_from" " [really: ${1}]"; +} +# rule:[subject] +if header :matches "Subject" "*" +{ + set "subject" "${1}"; +} +# rule:[from notify] +if address :matches "from" "*" +{ + set "from_addr" "${1}"; + notify :message "${from_addr}${env_from}: ${subject}" "mailto:alm@example.com"; +} diff --git a/plugins/managesieve/tests/src/parser_imapflags b/plugins/managesieve/tests/src/parser_imapflags index e67bf7cfc..7128f1ebb 100644 --- a/plugins/managesieve/tests/src/parser_imapflags +++ b/plugins/managesieve/tests/src/parser_imapflags @@ -1,7 +1,7 @@ -require ["imap4flags"]; -# rule:[imapflags] -if header :matches "Subject" "^Test$" -{ - setflag "\\Seen"; - addflag ["\\Answered","\\Deleted"]; -} +require ["imap4flags"]; +# rule:[imapflags] +if header :matches "Subject" "^Test$" +{ + setflag "\\Seen"; + addflag ["\\Answered","\\Deleted"]; +} diff --git a/plugins/managesieve/tests/src/parser_include b/plugins/managesieve/tests/src/parser_include index b5585a4ba..c11d1c5e5 100644 --- a/plugins/managesieve/tests/src/parser_include +++ b/plugins/managesieve/tests/src/parser_include @@ -1,7 +1,7 @@ -require ["include"]; -include "script.sieve"; -# rule:[two] -if true -{ - include :optional "second.sieve"; -} +require ["include"]; +include "script.sieve"; +# rule:[two] +if true +{ + include :optional "second.sieve"; +} diff --git a/plugins/managesieve/tests/src/parser_index b/plugins/managesieve/tests/src/parser_index index ca9f86d56..4d4f52092 100644 --- a/plugins/managesieve/tests/src/parser_index +++ b/plugins/managesieve/tests/src/parser_index @@ -1,24 +1,24 @@ -require ["comparator-i;ascii-numeric","date","fileinto","index","relational"]; -# rule:[index-header1] -if header :index 1 :last :contains "X-DSPAM-Result" "Spam" -{ - fileinto "Spam"; - stop; -} -# rule:[index-header2] -if header :index 2 :contains ["From","To"] "test@domain.tld" -{ - discard; - stop; -} -# rule:[index-address] -if address :index 1 :is "From" "nagios@domain.tld" -{ - fileinto "domain.tld"; - stop; -} -# rule:[index-date] -if date :index 1 :last :zone "-0500" :value "gt" :comparator "i;ascii-numeric" "received" "iso8601" "2007-02-26T09:00:00-05:00" -{ - stop; -} +require ["comparator-i;ascii-numeric","date","fileinto","index","relational"]; +# rule:[index-header1] +if header :index 1 :last :contains "X-DSPAM-Result" "Spam" +{ + fileinto "Spam"; + stop; +} +# rule:[index-header2] +if header :index 2 :contains ["From","To"] "test@domain.tld" +{ + discard; + stop; +} +# rule:[index-address] +if address :index 1 :is "From" "nagios@domain.tld" +{ + fileinto "domain.tld"; + stop; +} +# rule:[index-date] +if date :index 1 :last :zone "-0500" :value "gt" :comparator "i;ascii-numeric" "received" "iso8601" "2007-02-26T09:00:00-05:00" +{ + stop; +} diff --git a/plugins/managesieve/tests/src/parser_kep14.out b/plugins/managesieve/tests/src/parser_kep14.out index cb7faa7f8..b19ffb7b7 100644 --- a/plugins/managesieve/tests/src/parser_kep14.out +++ b/plugins/managesieve/tests/src/parser_kep14.out @@ -1,3 +1,3 @@ -require ["variables"]; -set "EDITOR" "Roundcube"; -set "EDITOR_VERSION" "123"; +require ["variables"]; +set "EDITOR" "Roundcube"; +set "EDITOR_VERSION" "123"; diff --git a/plugins/managesieve/tests/src/parser_nesting.out b/plugins/managesieve/tests/src/parser_nesting.out index 7384f757b..19b589a63 100644 --- a/plugins/managesieve/tests/src/parser_nesting.out +++ b/plugins/managesieve/tests/src/parser_nesting.out @@ -1,10 +1,10 @@ -# Sieve Filter -# Erzeugt von Ingo (http://www.horde.org/ingo/) (30.09.2016, 16:02) -# Nested rules aren't supported and will be ignored (#5540) - -# rule:[Ausgeschlossene Adressen] -if address :is ["From","Sender","Resent-From"] "noreply@example.org" -{ - discard; - stop; -} +# Sieve Filter +# Erzeugt von Ingo (http://www.horde.org/ingo/) (30.09.2016, 16:02) +# Nested rules aren't supported and will be ignored (#5540) + +# rule:[Ausgeschlossene Adressen] +if address :is ["From","Sender","Resent-From"] "noreply@example.org" +{ + discard; + stop; +} diff --git a/plugins/managesieve/tests/src/parser_notify_a b/plugins/managesieve/tests/src/parser_notify_a index e51e2aa8d..fc9940c4b 100644 --- a/plugins/managesieve/tests/src/parser_notify_a +++ b/plugins/managesieve/tests/src/parser_notify_a @@ -1,18 +1,18 @@ -require ["notify","variables"]; -# rule:[notify1] -if header :contains "from" "boss@example.org" -{ - notify :low :message "This is probably very important"; - stop; -} -# rule:[subject] -if header :matches "Subject" "*" -{ - set "subject" "${1}"; -} -# rule:[from notify2] -if header :matches "From" "*" -{ - set "from" "${1}"; - notify :high :method "mailto" :options "test@example.org" :message "${from}: ${subject}"; -} +require ["notify","variables"]; +# rule:[notify1] +if header :contains "from" "boss@example.org" +{ + notify :low :message "This is probably very important"; + stop; +} +# rule:[subject] +if header :matches "Subject" "*" +{ + set "subject" "${1}"; +} +# rule:[from notify2] +if header :matches "From" "*" +{ + set "from" "${1}"; + notify :high :method "mailto" :options "test@example.org" :message "${from}: ${subject}"; +} diff --git a/plugins/managesieve/tests/src/parser_notify_b b/plugins/managesieve/tests/src/parser_notify_b index f942e155f..97adb646c 100644 --- a/plugins/managesieve/tests/src/parser_notify_b +++ b/plugins/managesieve/tests/src/parser_notify_b @@ -1,17 +1,17 @@ -require ["envelope","notify","variables"]; -# rule:[from] -if envelope :matches "from" "*" -{ - set "env_from" " [really: ${1}]"; -} -# rule:[subject] -if header :matches "Subject" "*" -{ - set "subject" "${1}"; -} -# rule:[from notify] -if address :matches "from" "*" -{ - set "from_addr" "${1}"; - notify :method "sms" :options "1234567890" :message "${from_addr}${env_from}: ${subject}"; -} +require ["envelope","notify","variables"]; +# rule:[from] +if envelope :matches "from" "*" +{ + set "env_from" " [really: ${1}]"; +} +# rule:[subject] +if header :matches "Subject" "*" +{ + set "subject" "${1}"; +} +# rule:[from notify] +if address :matches "from" "*" +{ + set "from_addr" "${1}"; + notify :method "sms" :options "1234567890" :message "${from_addr}${env_from}: ${subject}"; +} diff --git a/plugins/managesieve/tests/src/parser_prefix b/plugins/managesieve/tests/src/parser_prefix index 9f6a33a1c..66c5a42bf 100644 --- a/plugins/managesieve/tests/src/parser_prefix +++ b/plugins/managesieve/tests/src/parser_prefix @@ -1,5 +1,5 @@ -# this is a comment -# and the second line - -require ["variables"]; -set "b" "c"; +# this is a comment +# and the second line + +require ["variables"]; +set "b" "c"; diff --git a/plugins/managesieve/tests/src/parser_relational b/plugins/managesieve/tests/src/parser_relational index 92c5e1a8e..37de64299 100644 --- a/plugins/managesieve/tests/src/parser_relational +++ b/plugins/managesieve/tests/src/parser_relational @@ -1,6 +1,6 @@ -require ["comparator-i;ascii-numeric","relational"]; -# rule:[redirect] -if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-score" "14" -{ - redirect "test@test.tld"; -} +require ["comparator-i;ascii-numeric","relational"]; +# rule:[redirect] +if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-score" "14" +{ + redirect "test@test.tld"; +} diff --git a/plugins/managesieve/tests/src/parser_subaddress b/plugins/managesieve/tests/src/parser_subaddress index e44555096..c1e3e2b37 100644 --- a/plugins/managesieve/tests/src/parser_subaddress +++ b/plugins/managesieve/tests/src/parser_subaddress @@ -1,11 +1,11 @@ -require ["envelope","fileinto","subaddress"]; -if envelope :user "To" "postmaster" -{ - fileinto "postmaster"; - stop; -} -if envelope :detail :is "To" "mta-filters" -{ - fileinto "mta-filters"; - stop; -} +require ["envelope","fileinto","subaddress"]; +if envelope :user "To" "postmaster" +{ + fileinto "postmaster"; + stop; +} +if envelope :detail :is "To" "mta-filters" +{ + fileinto "mta-filters"; + stop; +} diff --git a/plugins/managesieve/tests/src/parser_vacation b/plugins/managesieve/tests/src/parser_vacation index 8603d37c4..8567389dd 100644 --- a/plugins/managesieve/tests/src/parser_vacation +++ b/plugins/managesieve/tests/src/parser_vacation @@ -1,14 +1,14 @@ -require ["vacation"]; -# rule:[test-vacation] -if header :contains "Subject" "vacation" -{ - vacation :days 1 text: -# test -test test /* test */ -.. -..test -test -. -; - stop; -} +require ["vacation"]; +# rule:[test-vacation] +if header :contains "Subject" "vacation" +{ + vacation :days 1 text: +# test +test test /* test */ +.. +..test +test +. +; + stop; +} diff --git a/plugins/managesieve/tests/src/parser_vacation_seconds b/plugins/managesieve/tests/src/parser_vacation_seconds index 75cbcae46..f7543f7b7 100644 --- a/plugins/managesieve/tests/src/parser_vacation_seconds +++ b/plugins/managesieve/tests/src/parser_vacation_seconds @@ -1,12 +1,12 @@ -require ["vacation-seconds"]; -# rule:[test-vacation] -if header :contains "Subject" "vacation" -{ - vacation :seconds 0 text: -# test -test test /* test */ -test -. -; - stop; -} +require ["vacation-seconds"]; +# rule:[test-vacation] +if header :contains "Subject" "vacation" +{ + vacation :seconds 0 text: +# test +test test /* test */ +test +. +; + stop; +} diff --git a/plugins/managesieve/tests/src/parser_variables b/plugins/managesieve/tests/src/parser_variables index c4ea2f72a..4dcee7c4c 100644 --- a/plugins/managesieve/tests/src/parser_variables +++ b/plugins/managesieve/tests/src/parser_variables @@ -1,24 +1,24 @@ -require ["variables"]; -set "honorific" "Mr"; -set "vacation" text: -Dear ${HONORIFIC} ${last_name}, -I am out, please leave a message after the meep. -. -; -set :length "b" "${a}"; -set :lower "b" "${a}"; -set :upperfirst "b" "${a}"; -set :upperfirst :lower "b" "${a}"; -set :quotewildcard "b" "Rock*"; -if string :matches " ${state} " "* pending *" -{ - set "test1" "*"; -} -if string ["aaa","bbb"] ["aaa","bbb"] -{ - set "test2" "*"; -} -if string :is :comparator "i;octet" "bbb" "bbb" -{ - set "test3" "*"; -} +require ["variables"]; +set "honorific" "Mr"; +set "vacation" text: +Dear ${HONORIFIC} ${last_name}, +I am out, please leave a message after the meep. +. +; +set :length "b" "${a}"; +set :lower "b" "${a}"; +set :upperfirst "b" "${a}"; +set :upperfirst :lower "b" "${a}"; +set :quotewildcard "b" "Rock*"; +if string :matches " ${state} " "* pending *" +{ + set "test1" "*"; +} +if string ["aaa","bbb"] ["aaa","bbb"] +{ + set "test2" "*"; +} +if string :is :comparator "i;octet" "bbb" "bbb" +{ + set "test3" "*"; +}