summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@pardus.de>2010-04-07 03:25:06 (GMT)
committerGunnar Wrobel <wrobel@pardus.de>2010-04-07 03:25:06 (GMT)
commit3b340a857f30affb66c216a3dac70404585a9527 (patch)
tree9dc03b0a9c288c1087818c5666190c92cbded88e
parent419b3f70765890a507e36d9e11f3327cd5172ac8 (diff)
downloadkolab-webadmin-3b340a857f30affb66c216a3dac70404585a9527.tar.gz
Ensure we always generate valid sieve.
-rw-r--r--lib/KolabAdmin/Sieve/Segment/Forward.php11
-rw-r--r--lib/KolabAdmin/Sieve/Segment/Vacation.php10
2 files changed, 16 insertions, 5 deletions
diff --git a/lib/KolabAdmin/Sieve/Segment/Forward.php b/lib/KolabAdmin/Sieve/Segment/Forward.php
index eee8fc5..7acf993 100644
--- a/lib/KolabAdmin/Sieve/Segment/Forward.php
+++ b/lib/KolabAdmin/Sieve/Segment/Forward.php
@@ -59,7 +59,7 @@ extends KolabAdmin_Sieve_Segment
{
$this->template = 'if allof (%s' . "\r\n" .
') {' . "\r\n" .
- 'redirect "%s";%s' . "\r\n" .
+ '%s%s' . "\r\n" .
'}' . "\r\n";
parent::__construct($script);
}
@@ -83,6 +83,9 @@ extends KolabAdmin_Sieve_Segment
*/
public function setForwardAddress($address)
{
+ if (empty($address)) {
+ throw new Exception('Please enter a valid e-mail address!');
+ }
$this->_forward_address = $address;
}
@@ -111,8 +114,10 @@ extends KolabAdmin_Sieve_Segment
public function getArguments()
{
$address = $this->getForwardAddress();
- if (empty($address)) {
- throw new Exception('Please enter a valid e-mail address!');
+ if (!empty($address)) {
+ $address = 'redirect "' . $address . '";';
+ } else {
+ $address = '';
}
return array(
($this->isActive()) ? 'true ## forward enabled' : 'false ## forward disabled',
diff --git a/lib/KolabAdmin/Sieve/Segment/Vacation.php b/lib/KolabAdmin/Sieve/Segment/Vacation.php
index 96cf66a..a025bc5 100644
--- a/lib/KolabAdmin/Sieve/Segment/Vacation.php
+++ b/lib/KolabAdmin/Sieve/Segment/Vacation.php
@@ -85,7 +85,7 @@ extends KolabAdmin_Sieve_Segment
$this->template = 'if allof (%s' . "\r\n" .
'%s,' . "\r\n" .
'%s) {' . "\r\n" .
- 'vacation :addresses [ %s ] :days %s text:' . "\r\n" .
+ 'vacation %s :days %s text:' . "\r\n" .
'%s' . "\r\n" .
'.' . "\r\n" .
';' . "\r\n" .
@@ -241,11 +241,17 @@ extends KolabAdmin_Sieve_Segment
} else {
$react_to_spam = 'true';
}
+ $addresses = $this->getRecipientAddresses();
+ if (!empty($addresses)) {
+ $addresses = ':addresses [ "' . join('", "', $this->getRecipientAddresses()) . '" ]';
+ } else {
+ $addresses = '';
+ }
return array(
($this->isActive()) ? 'true, ## vacation enabled' : 'false, ## vacation disabled',
$domain,
$react_to_spam,
- '"' . join('", "', $this->getRecipientAddresses()) . '"',
+ $addresses,
$this->getResendAfter(),
$this->getResponse()
);