from maildroprc(5) : The exit statement causes *maildrop* to terminate
[old-projects.git] / philter / philter / include / plugin_autoreply.inc.php
index cc517e0..3cbccc9 100644 (file)
@@ -32,16 +32,15 @@ EOF;
     function to_string($_data) {
         $uid = get_user_id();
         $text = explode("\n",$_data[1]);
-        $res = "| ( formail -rA'X-Philter-Autoreply: $uid; \ \n";
-        foreach($text as $line)
-            $res .= "    echo ".escapeshellarg($line)."; \ \n";
-        $res .= " ) | $"."SENDMAIL -oi -t\n";
-    }
 
-    function to_header_string() {
-        return "* ^X-Philter-Autoreply:".get_user_id()."\n"
-            .  "/dev/null\n"
-            .  "\n";
+        $res = "    if(! /^X-Philter-Autoreply: $uid$/)\n" # TODO : et ne vient pas da démon
+            .  "    {\n"
+            .  "        cc \"| reformail -rt -A'X-Philter-Autoreply: $uid' \\\n"
+            .  "            | ( cat - ; echo '' ; \\\n";
+        foreach($text as $line)
+            $res .= "                echo ".escapeshellarg(chop($line))."; \\\n";
+        $res.= "            ) | $"."SENDMAIL -oi -t\"\n";
+        return $res."    }\n";
     }
 }