gunnar: server/kolab-webadmin/kolab-webadmin/lib/KolabAdmin/Sieve/Segment Forward.php, 1.2, 1.3 Vacation.php, 1.3, 1.4

cvs at kolab.org cvs at kolab.org
Wed Apr 7 05:25:09 CEST 2010


Author: gunnar

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/lib/KolabAdmin/Sieve/Segment
In directory doto:/tmp/cvs-serv25213/kolab-webadmin/lib/KolabAdmin/Sieve/Segment

Modified Files:
	Forward.php Vacation.php 
Log Message:
Ensure we always generate valid sieve.

Index: Forward.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/lib/KolabAdmin/Sieve/Segment/Forward.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Forward.php	6 Apr 2010 17:47:34 -0000	1.2
+++ Forward.php	7 Apr 2010 03:25:06 -0000	1.3
@@ -59,7 +59,7 @@
     {
         $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 @@
      */
     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 @@
     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',

Index: Vacation.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/lib/KolabAdmin/Sieve/Segment/Vacation.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Vacation.php	6 Apr 2010 17:47:34 -0000	1.3
+++ Vacation.php	7 Apr 2010 03:25:06 -0000	1.4
@@ -85,7 +85,7 @@
         $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 @@
         } 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()
         );





More information about the commits mailing list