Code

Added new function get_sieve
[gosa.git] / include / sieve / class_sieveElement_Vacation.inc
index f2a562fcaaf518ccc820a70de711c825c734d129..6854b1862e5c74ff4c4e6a261770444bf3e17217 100644 (file)
@@ -14,6 +14,8 @@ class sieve_vacation
 
   function sieve_vacation($data,$object_id)
   {
+
+    $this->object_id = $object_id;
     /* Usage:   vacation [":days" number] [":subject" string]
        [":from" string] [":addresses" string-list]
        [":mime"] [":handle" string] <reason: string> */
@@ -22,7 +24,7 @@ class sieve_vacation
     $known_attrs = array(":days",":subject",":from",":mime",":handle");
 
     /* skip if empty */
-    if($data == NULL) return;
+    if(($data == NULL) || !is_array($data)) return;
 
     /* Walk through elements */
     for($i = 0 ; $i < count($data['ELEMENTS']) ; $i ++){
@@ -57,8 +59,16 @@ class sieve_vacation
       }
 
       /* Add the vacation message */
-      if($node['class'] == "quoted-string"){
-        $this->reason = $node['text'];
+      if(in_array($node['class'],array("quoted-string","multi-line"))){
+
+        $tmp = sieve_get_strings($data['ELEMENTS'],$i);
+        $strs= $tmp['STRINGS'];
+        $data = ""; 
+        foreach($strs as $str){
+          $data .= $str;
+        }
+        $this->reason = $data;//preg_replace("/\"/","",$data);
       }
     }
   }