Code

Updated tree class && reject also supports "text" reasons
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 23 Mar 2007 06:58:49 +0000 (06:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 23 Mar 2007 06:58:49 +0000 (06:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5867 594d385d-05f5-0310-b6e9-bd551577e9d8

include/sieve/class_semantics.inc
include/sieve/class_tree.inc

index 44a376829a136d25652eb4f64cdc432965859929..1f34d6063e16586faaec517dffda554a57548efe 100644 (file)
@@ -141,7 +141,7 @@ class Semantics
                                'valid_after' => $this->nonTestCommands_,
                                'arguments' => array(
                                        array('class' => 'string', 'occurrences' => '1', 'values' => array(
-                                               array('occurrences' => '1', 'regex' => '".*"', 'name' => 'reason')
+                                               array('occurrences' => '1', 'regex' => '("|).*("|)', 'name' => 'reason')
                                        ))
                                )
                        );
@@ -610,4 +610,4 @@ class Semantics
        }
 }
 
-?>
\ No newline at end of file
+?>
index 920b809ce28e65417ee4ffb2a56dd3e30f4ba4ac..37198f0cd803fc3545b7b1b9855b1c9587c131e8 100644 (file)
@@ -99,27 +99,6 @@ class Tree
                return $this->nodes_[$node_id];
        }
 
-       function getLastNode($parent_id)
-       {
-               $childs = $this->getChilds($parent_id);
-
-               for ($i=count($childs); $i>0; --$i)
-               {
-                       $node = $this->getNode($childs[$i-1]);
-                       if ($node['text'] == '{')
-                       {
-                               // return command owning the block
-                               return $this->getNode($parent_id);
-                       }
-                       if ($node['class'] != 'comment')
-                       {
-                               return $node;
-                       }
-               }
-
-               return $this->getNode($parent_id);
-       }
-
        function setDumpFunc($callback)
        {
                if ($callback == NULL || is_callable($callback))
@@ -140,12 +119,12 @@ class Tree
                if ($last)
                {
                        $infix = '`--- ';
-                       $c_prefix = $prefix . '   ';
+                       $child_prefix = $prefix . '   ';
                }
                else
                {
                        $infix = '|--- ';
-                       $c_prefix = $prefix . '|  ';
+                       $child_prefix = $prefix . '|  ';
                }
 
                $node = $this->nodes_[$node_id];
@@ -158,18 +137,17 @@ class Tree
                        $this->dump_ .= "$prefix$infix$node\n";
                }
 
-               $childs = $this->childs_[$node_id];
-               for ($i=0; $i<count($childs); ++$i)
+               if (isset($this->childs_[$node_id]))
                {
-                       $c_last = false;
-                       if ($i+1 == count($childs))
+                       $childs = $this->childs_[$node_id];
+                       $last_child = count($childs);
+
+                       for ($i=1; $i <= $last_child; ++$i)
                        {
-                               $c_last = true;
+                               $this->doDump_($childs[$i-1], $child_prefix, ($i == $last_child ? true : false));
                        }
-
-                       $this->doDump_($childs[$i], $c_prefix, $c_last);
                }
        }
 }
 
-?>
+?>
\ No newline at end of file