from maildroprc(5) : The exit statement causes *maildrop* to terminate
[old-projects.git] / philter / philter / include / rule.inc.php
index f31c20e..a449918 100644 (file)
@@ -87,7 +87,23 @@ class Rule {
     }
 
     function to_string() {
-        return "";
+        global $philter;
+        $tmp = array();
+
+        foreach($this->matches as $match)
+            $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['action_plugins'][$action[0]]->to_string($action);
+
+        if($this->block)
+            $res .= "    exit\n";
+        
+        return $res."}\n\n";
     }
 
     function sql_clean($_uid, $_rid) {