from maildroprc(5) : The exit statement causes *maildrop* to terminate
[old-projects.git] / philter / philter / include / rule.inc.php
index 5f1736d..a449918 100644 (file)
@@ -88,16 +88,22 @@ class Rule {
 
     function to_string() {
         global $philter;
-        
-        $res = ($this->block ? ":0\n" : ":0 c\n");
+        $tmp = array();
+
         foreach($this->matches as $match)
-            $res .= $philter->config['match_plugins'][$match[0]]->to_string($match);
-        $res.= "{\n";
+            $tmp[] = $philter->config['match_plugins'][$match[0]]->to_string($match);
+        
+        $connector = ($this->all ? ' && ' : ' || ');
+        $res = "if( ".implode($connector, $tmp)." )\n"
+            .  "{\n";
+        
         foreach($this->actions as $action)
-            $res .= $philter->config['actioh_plugins'][$action[0]]->to_string($action);
-        $res.= "}\n\n";
+            $res .= $philter->config['action_plugins'][$action[0]]->to_string($action);
 
-        return $res;
+        if($this->block)
+            $res .= "    exit\n";
+        
+        return $res."}\n\n";
     }
 
     function sql_clean($_uid, $_rid) {