mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
Sieve filters (interface/vacation action)
This commit is contained in:
parent
54edeaa645
commit
68cc322bd5
26 changed files with 235 additions and 104 deletions
|
|
@ -39,6 +39,11 @@ class Filter
|
|||
*/
|
||||
private $sActionValue;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sActionValueSecond;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
|
@ -72,6 +77,7 @@ class Filter
|
|||
|
||||
$this->sActionType = \RainLoop\Providers\Filters\Enumerations\ActionType::MOVE_TO;
|
||||
$this->sActionValue = '';
|
||||
$this->sActionValueSecond = '';
|
||||
|
||||
$this->bMarkAsRead = false;
|
||||
$this->bSkipOthers = false;
|
||||
|
|
@ -134,6 +140,14 @@ class Filter
|
|||
return $this->sActionValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ActionValueSecond()
|
||||
{
|
||||
return $this->sActionValueSecond;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
|
@ -201,6 +215,7 @@ class Filter
|
|||
\RainLoop\Providers\Filters\Enumerations\ActionType::MOVE_TO;
|
||||
|
||||
$this->sActionValue = isset($aFilter['ActionValue']) ? $aFilter['ActionValue'] : '';
|
||||
$this->sActionValueSecond = isset($aFilter['ActionValueSecond']) ? $aFilter['ActionValueSecond'] : '';
|
||||
|
||||
$this->bMarkAsRead = isset($aFilter['MarkAsRead']) ? $aFilter['MarkAsRead'] : false;
|
||||
$this->bSkipOthers = isset($aFilter['SkipOthers']) ? $aFilter['SkipOthers'] : false;
|
||||
|
|
@ -239,6 +254,7 @@ class Filter
|
|||
'ConditionsType' => $this->ConditionsType(),
|
||||
'ActionType' => $this->ActionType(),
|
||||
'ActionValue' => $this->ActionValue(),
|
||||
'ActionValueSecond' => $this->ActionValueSecond(),
|
||||
'MarkAsRead' => $this->MarkAsRead(),
|
||||
'SkipOthers' => $this->SkipOthers()
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7,5 +7,6 @@ class ActionType
|
|||
const NONE = 'None';
|
||||
const MOVE_TO = 'MoveTo';
|
||||
const DISCARD = 'Discard';
|
||||
const VACATION = 'Vacation';
|
||||
const FORWARD = 'Forward';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,6 +195,28 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
|
|||
$aResult[] = $sTab.'discard;';
|
||||
$aResult[] = $sTab.'stop;';
|
||||
break;
|
||||
case \RainLoop\Providers\Filters\Enumerations\ActionType::VACATION:
|
||||
$sValue = \trim($oFilter->ActionValue());
|
||||
$sValueSecond = \trim($oFilter->ActionValueSecond());
|
||||
if (0 < \strlen($sValue))
|
||||
{
|
||||
$aCapa['vacation'] = true;
|
||||
|
||||
$sSubject = '';
|
||||
if (0 < \strlen($sValueSecond))
|
||||
{
|
||||
$sSubject = ':subject "'.$this->quote(
|
||||
\preg_replace('/[\s]+/u', ' ', $sValueSecond)).'" ';
|
||||
}
|
||||
|
||||
$aResult[] = $sTab.'vacation :days 1 '.$sSubject.'"'.$this->quote($sValue).'";';
|
||||
$aResult[] = $sTab.'stop;';
|
||||
}
|
||||
else
|
||||
{
|
||||
$aResult[] = $sTab.'# @Error (vacation): empty action value';
|
||||
}
|
||||
break;
|
||||
case \RainLoop\Providers\Filters\Enumerations\ActionType::FORWARD:
|
||||
$sValue = $oFilter->ActionValue();
|
||||
if (0 < \strlen($sValue))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue