to_header_string was a bad idea...
authorPierre Habouzit <madcoder@debian.org>
Mon, 22 Sep 2003 16:28:38 +0000 (16:28 +0000)
committerPierre Habouzit <madcoder@debian.org>
Mon, 22 Sep 2003 16:28:38 +0000 (16:28 +0000)
philter/philter/include/plugin.inc.php
philter/philter/include/plugin_autoreply.inc.php
philter/philter/include/plugin_forward.inc.php
philter/philter/include/plugin_header.inc.php

index 851cce4..71894c3 100644 (file)
@@ -54,8 +54,6 @@ class Plugin {
      */
     function to_string($_data) { return ""; }
 
-    function to_header_string() { return ""; }
-
     /** returns the function that creates the form in javascript (@see FwdPlugin for one example).
      * @return  the string containing the javascript code
      */
index cc517e0..e068ce1 100644 (file)
@@ -32,16 +32,13 @@ EOF;
     function to_string($_data) {
         $uid = get_user_id();
         $text = explode("\n",$_data[1]);
-        $res = "| ( formail -rA'X-Philter-Autoreply: $uid; \ \n";
+        $res = "    :0 hc\n"
+            .  "    *X-Philter-Autoreply: $uid"
+            .  "    | ( 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 .= "        echo ".escapeshellarg($line)."; \ \n";
+        $res.= "      ) | $"."SENDMAIL -oi -t\n";
+        return $res;
     }
 }
 
index 4e2c6a0..fb1d0d4 100644 (file)
@@ -13,25 +13,30 @@ class FwdPlugin extends ActionPlugin {
     function name() { return _i18n('1_fwd_to'); }
 
     function to_js() {
-        $res  = "function(Node, data) {\n"
-            .   "    var i,j;\n"
-            .   "    var sel = 0;\n"
-            .   "    var select = document.createElement('select');\n"
-            .   "    select.setAttribute('name', Node.name+'[1]');\n"
-            .   "    Node.appendChild(document.createTextNode(' '));\n"
-            .   "\n"
-            // OG: must insert select node before creating options because of IE5 bug
-            .   "    Node.appendChild(select);\n"
-            .   "\n"
-            .   "    for(i=0,j=0; i<mail_pool.length; i++) {\n"
-            .   "        if(data[1]==i) sel = j;\n"
-            .   "        if(mail_pool[i])\n"
-            .   "            select.options[j++] = new Option(mail_pool[i],i,false,(data[1]==i));\n"
-            .   "    }\n"
-            .   "    select.selectedIndex = sel;\n"
-            .   "}";
+        return <<<EOF
+function(Node, data) {
+    var i,j;
+    var sel = 0;
+    var select = document.createElement('select');
+    select.setAttribute('name', Node.name+'[1]');
+    Node.appendChild(document.createTextNode(' '));
 
-        return $res;
+    // OG: must insert select node before creating options because of IE5 bug
+    Node.appendChild(select);
+
+    for(i=0,j=0; i<mail_pool.length; i++) {
+        if(data[1]==i) sel = j;
+        if(mail_pool[i])
+            select.options[j++] = new Option(mail_pool[i],i,false,(data[1]==i));
+    }
+    select.selectedIndex = sel;
+}
+EOF;
+    }
+
+    function to_string($_data) {
+        global $mail_pool;
+        return "! ".$mail_pool->emails[$_data[1]]->email."\n";
     }
 }
 
index b9b8e56..fa26d49 100644 (file)
@@ -13,8 +13,8 @@ class HdrPlugin extends MatchPlugin {
     function name() { return _i18n('2_hdr'); }
 
     function to_js() {
-        return
-"function(Node, data) {
+        return <<<EOF
+function(Node, data) {
     var i,j;
     var sel = 0;
     
@@ -56,7 +56,8 @@ class HdrPlugin extends MatchPlugin {
     txt_i.setAttribute('name', Node.name+'[3]');
     txt_i.setAttribute('value', (data[3] ? data[3] : '') );
     Node.appendChild(txt_i);
-}";
+}
+EOF;
     }
 }