From c9b71125a329bad01b1b0c4b5b4ad4b2169a2068 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 15 Mar 2007 12:38:27 +0000 Subject: [PATCH] Fixed vacation saving git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5789 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/sieve/class_My_Tree.inc | 9 +++++++-- include/sieve/class_sieveElement_Vacation.inc | 14 +++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/include/sieve/class_My_Tree.inc b/include/sieve/class_My_Tree.inc index 0ac92a0c1..901018c65 100644 --- a/include/sieve/class_My_Tree.inc +++ b/include/sieve/class_My_Tree.inc @@ -728,7 +728,7 @@ class My_Tree extends Tree /* Create valid sieve string/string-list * out of a given array */ -function sieve_create_strings($data) +function sieve_create_strings($data,$force_string = FALSE) { $ret = ""; if(is_array($data)){ @@ -752,7 +752,7 @@ function sieve_create_strings($data) $Multiline = preg_match("/\n/",$data); $data = preg_replace("/\r/","",$data);; - if($Multiline){ + if($Multiline && !$force_string){ $ret = "text: \r\n".$data."\r\n.\r\n"; }else{ $ret = "\"".$data."\""; @@ -786,7 +786,12 @@ function sieve_get_strings($data,$id) $ret[] = $data[$id]['text']; }elseif($data[$id]['class'] == "number"){ $ret[] = $data[$id]['text']; + }elseif($data[$id]['class'] == "multi-line"){ + $str = trim(preg_replace("/^text:/","",$data[$id]['text'])); + $str = trim(preg_replace("/\.$/","",$str)); + $ret[] = $str; } + return(array("OFFSET" => $id, "STRINGS" => $ret)); } diff --git a/include/sieve/class_sieveElement_Vacation.inc b/include/sieve/class_sieveElement_Vacation.inc index f2a562fca..1809cad8b 100644 --- a/include/sieve/class_sieveElement_Vacation.inc +++ b/include/sieve/class_sieveElement_Vacation.inc @@ -22,7 +22,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 +57,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); } } } -- 2.30.2