procmail generation TODO: implement each plugin. plugins : forward, header,
authorPierre Habouzit <madcoder@debian.org>
Tue, 21 Oct 2003 20:29:18 +0000 (20:29 +0000)
committerPierre Habouzit <madcoder@debian.org>
Tue, 21 Oct 2003 20:29:18 +0000 (20:29 +0000)
    custheader are OK (or should be)

philter/philter/include/filter.inc.php
philter/philter/include/plugin_bogofilter.inc.php

index b46a255..088d212 100644 (file)
@@ -48,6 +48,7 @@ class Filter {
     }
     
     function to_string() {
+        global $mail_pool,$philter;
         $res = ":0 f\n"
             .  "|formail -I'X-Philter-Or'\n"
             .  "\n";
@@ -55,8 +56,17 @@ class Filter {
         foreach($this->rules as $id=>$rule)
             if($id)
                 $res .= $rule->to_string();
-
-        return $res;
+            else
+                foreach($rule->matches as $id=>$match)
+                    $res .= $philter->config['global_plugins'][$match[0]]->to_string($match);
+
+        $res .= ":0\n"
+             .  "!";
+        foreach($mail_pool->emails as $mail)
+            if($mail->is_active())
+                $res .= ' '.$mail->email;
+        
+        return $res."\n";
     }
 
     function delete_rule($_rid) {
index fd90fa5..e50488d 100644 (file)
@@ -16,24 +16,7 @@ class BogoPlugin extends MatchPlugin {
     function is_global() { return true; }
 
     function to_string($_data) {
-        if($_data['data']=='off')
-            return "";
-
-        $res = ":0 HB\n"
-            .  "* ? bogofilter\n"
-            .  "{\n"
-            .  "    :0 c\n"
-            .  "    /var/mail/spam/\n"
-            .  "    :0 h\n"
-            .  "    SUBJECT=| formail -xSubject:\n"
-            .  "    :0 fhW\n"
-            .  "    | formail -I \"X-Spam-Flag: YES\" -i \"Subject: [Xorg:SPAM]$"."SUBJECT\"\n"
-            . ($_data["data"] == "drop" ? "    :0\n    /dev/null\n" : "")
-            .  "}\n"
-            .  ":0 Ec\n"
-            .  "/var/mail/nonspam/\n"
-            .  "\n";
-
+        $res = "\n";
         return $res;
     }