Revert "* Mail/Sieve: fix vacation message with redirect kept mail in INBOX, even if rule moved it to a folder"

Cause mails never to be left in INBOX :(

This reverts commit 41e102f015.
This commit is contained in:
ralf 2023-11-29 16:59:59 +02:00
parent 2aedd7f5ef
commit bca70c7b86

View File

@ -276,11 +276,7 @@ class Script
if (!$this->extensions['vacation']) $this->vacation = false; if (!$this->extensions['vacation']) $this->vacation = false;
// for vacation with redirect we need to keep track were the mail goes, to add an explicit keep $newscriptbody = "";
if ($this->extensions['variables'] && $this->vacation)
{
$newscriptbody = 'set "action" "inbox";'."\n\n";
}
$continue = 1; $continue = 1;
foreach ($this->rules as $rule) { foreach ($this->rules as $rule) {
@ -409,16 +405,7 @@ class Script
if (preg_match("/flags/i",$rule['action'])) { if (preg_match("/flags/i",$rule['action'])) {
$newruletext .= "addflag \"".$rule['action_arg']."\";"; $newruletext .= "addflag \"".$rule['action_arg']."\";";
} }
if ($rule['keep']) if ($rule['keep']) $newruletext .= "\n\tkeep;";
{
$newruletext .= "\n\tkeep;";
}
// for vacation with redirect we need to keep track were the mail goes, to NOT add an explicit keep
elseif ($this->extensions['variables'] && $this->vacation &&
preg_match('/(folder|reject|address|discard)/', $rule['action']))
{
$newruletext .= "\n\tset \"action\" \"$rule[action]\";";
}
if (!$rule['unconditional']) $newruletext .= "\n}"; if (!$rule['unconditional']) $newruletext .= "\n}";
$continue = 0; $continue = 0;
@ -481,11 +468,7 @@ class Script
{ {
$vac_rule .= "\tredirect \"" . trim($addr) . "\";\n"; $vac_rule .= "\tredirect \"" . trim($addr) . "\";\n";
} }
// if there is no other action e.g. fileinto before, we need to add an explicit keep, as the implicit on is canceled by the vaction redirect! $vac_rule .= "\tkeep;\n}\n";
if ($this->extensions['variables']) $vac_rule .= "\tif string :is \"action\" \"inbox\" {\n";
$vac_rule .= "\t\tkeep;\n";
if ($this->extensions['variables']) $vac_rule .= "\t}\n";
$vac_rule .= "}\n";
} }
if (!isset($vacation['modus']) || $vacation['modus'] !== 'store') if (!isset($vacation['modus']) || $vacation['modus'] !== 'store')
{ {
@ -602,10 +585,9 @@ class Script
} else { } else {
// no active rules, but might still have an active vacation rule // no active rules, but might still have an active vacation rule
$closeRequired = false; $closeRequired = false;
if ($this->vacation) if ($this->vacation && $vacation_active)
{ {
$newscripthead .= "require [\"vacation\""; $newscripthead .= "require [\"vacation\"";
if ($this->extensions['variables']) $newscripthead .= ',"variables"';
if ($this->extensions['regex'] && $regexused) $newscripthead .= ",\"regex\""; if ($this->extensions['regex'] && $regexused) $newscripthead .= ",\"regex\"";
if ($this->extensions['date']) $newscripthead .= ",\"date\""; if ($this->extensions['date']) $newscripthead .= ",\"date\"";
if ($this->extensions['relational']) $newscripthead .= ",\"relational\""; if ($this->extensions['relational']) $newscripthead .= ",\"relational\"";