[dev] Ingo sieve/vacation patch

Max Kalika max+lists.horde.dev at lsit.ucsb.edu
Wed Jul 16 13:26:39 PDT 2003


Would anyone (Mike/Michael) object if I commit the attached patch?  It
fixes syntax errors/notices on vacation activation when nothing has been
set yet.

---max kalika
--max at lsit.ucsb.edu
-lsit systems administrator
-------------- next part --------------
Index: lib/Script/sieve.php
===================================================================
RCS file: /repository/ingo/lib/Script/sieve.php,v
retrieving revision 1.42
diff -U0 -r1.42 sieve.php
--- lib/Script/sieve.php	16 Jul 2003 17:53:46 -0000	1.42
+++ lib/Script/sieve.php	16 Jul 2003 20:24:05 -0000
@@ -284,28 +284,21 @@
-            $vals = array('subject' => $vacation['subject'],
-                          'days' => $vacation['days'],
-                          'addresses' => $vacation['addresses'],
-                          'reason' => $vacation['reason']);
-
-            include_once HORDE_BASE . '/lib/MIME/Headers.php';
-            $mime_headers = &new MIME_Headers();
-            $listHeaders = $mime_headers->listHeaders();
-
-            $action[] = &new Sieve_Action_Vacation($vals);
-
-            if ($vacation['ignorelist']) {
-                $tmp = &new Sieve_Test_Exists(array('headers' => implode("\n", $listHeaders)));
-                $tests[] = &new Sieve_Test_Not($tmp);
-                $vals = array('headers' => 'Precedence',
-                              'match-type' => ':is',
-                              'strings' => 'list,bulk',
-                              'comparator' => 'i;ascii-casemap');
-                $tmp = &new Sieve_Test_Header($vals);
-                $tests[] = new Sieve_Test_Not($tmp);
-            }
-
-            $excludes = preg_split('(\n|\n|\r)', $vacation['excludes']);
-            $addrs = array();
-            foreach ($excludes as $addr) {
-                $addr = trim($addr);
-                if (!empty($addr)) {
-                    $addrs[] = $addr;
+            if (count($vacation)) {
+                $vals = array('subject' => $vacation['subject'],
+                              'days' => $vacation['days'],
+                              'addresses' => $vacation['addresses'],
+                              'reason' => $vacation['reason']);
+
+                include_once HORDE_BASE . '/lib/MIME/Headers.php';
+                $mime_headers = &new MIME_Headers();
+                $listHeaders = $mime_headers->listHeaders();
+
+                $action[] = &new Sieve_Action_Vacation($vals);
+
+                if ($vacation['ignorelist']) {
+                    $tmp = &new Sieve_Test_Exists(array('headers' => implode("\n", $listHeaders)));
+                    $tests[] = &new Sieve_Test_Not($tmp);
+                    $vals = array('headers' => 'Precedence',
+                                  'match-type' => ':is',
+                                  'strings' => 'list,bulk',
+                                  'comparator' => 'i;ascii-casemap');
+                    $tmp = &new Sieve_Test_Header($vals);
+                    $tests[] = new Sieve_Test_Not($tmp);
@@ -313 +305,0 @@
-            }
@@ -315,15 +307,25 @@
-            if (count($addrs) > 0) {
-                $tmp = &new Sieve_Test_Address(array('headers' => "From\nSender\nResent-From", 'addresses' => implode("\n", $addrs)));
-                $tests[] = &new Sieve_Test_Not($tmp);
-            }
-
-            $comment = &new Sieve_Comment(_("Vacation Message"));
-            $vacationBlocks[] = $comment;
-
-            if (count($tests) > 0) {
-                $test = &new Sieve_Test_Allof($tests);
-                $if = &new Sieve_If($test);
-                $if->setActions($action);
-                $vacationBlocks[] = $if;
-            } else {
-                $vacationBlocks[] = $action[0];
+                $excludes = preg_split('(\n|\n|\r)', $vacation['excludes']);
+                $addrs = array();
+                foreach ($excludes as $addr) {
+                    $addr = trim($addr);
+                    if (!empty($addr)) {
+                        $addrs[] = $addr;
+                    }
+                }
+
+                if (count($addrs) > 0) {
+                    $tmp = &new Sieve_Test_Address(array('headers' => "From\nSender\nResent-From", 'addresses' => implode("\n", $addrs)));
+                    $tests[] = &new Sieve_Test_Not($tmp);
+                }
+
+                $comment = &new Sieve_Comment(_("Vacation Message"));
+                $vacationBlocks[] = $comment;
+
+                if (count($tests) > 0) {
+                    $test = &new Sieve_Test_Allof($tests);
+                    $if = &new Sieve_If($test);
+                    $if->setActions($action);
+                    $vacationBlocks[] = $if;
+                } else {
+                    $vacationBlocks[] = $action[0];
+                }


More information about the dev mailing list