From 93c4f397b3fbe4497714241222cd8645354dc8ff Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 14 Oct 2024 18:39:06 +0200 Subject: [PATCH] * Mail: fix Sieve editor considers mail body rules wrongly as unconditional, if there are more than one rule --- api/src/Mail/Script.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/api/src/Mail/Script.php b/api/src/Mail/Script.php index fe191e6c0a..3ea68a2b2d 100644 --- a/api/src/Mail/Script.php +++ b/api/src/Mail/Script.php @@ -173,8 +173,9 @@ class Script $rule['ctype'] = ($bits[14]??null); $rule['field_ctype_val'] = ($bits[15]??null); $rule['unconditional'] = 0; - if (!$rule['from'] && !$rule['to'] && !$rule['subject'] && - !$rule['field'] && !$rule['size'] && $rule['action']) { + if ($rule['action'] && !$rule['from'] && !$rule['to'] && !$rule['subject'] && + !$rule['field'] && !$rule['size'] && !$rule['field_bodytransform'] && !$rule['ctype']) + { $rule['unconditional'] = 1; } @@ -301,7 +302,7 @@ class Script } $started = 0; - if (!$rule['unconditional']) { + if (empty($rule['unconditional'])) { if (!$continue) $newruletext .= "els"; $newruletext .= "if " . $anyall . " ("; if ($rule['from']) { @@ -388,7 +389,7 @@ class Script // actions - if (!$rule['unconditional']) $newruletext .= ") {\n\t"; + if (empty($rule['unconditional'])) $newruletext .= ") {\n\t"; if (preg_match("/folder/i",$rule['action'])) { $newruletext .= "fileinto \"" . ($utf7imap_fileinto ? @@ -420,11 +421,11 @@ class Script { $newruletext .= "\n\tset \"action\" \"$rule[action]\";"; } - if (!$rule['unconditional']) $newruletext .= "\n}"; + if (empty($rule['unconditional'])) $newruletext .= "\n}"; $continue = 0; if ($rule['continue']) $continue = 1; - if ($rule['unconditional']) $continue = 1; + if (!empty($rule['unconditional'])) $continue = 1; $newscriptbody .= $newruletext . "\n\n";