add header plugin
authorPierre Habouzit <madcoder@debian.org>
Thu, 6 Nov 2003 11:11:58 +0000 (11:11 +0000)
committerPierre Habouzit <madcoder@debian.org>
Thu, 6 Nov 2003 11:11:58 +0000 (11:11 +0000)
philter/philter/include/plugin_addheader.inc.php [new file with mode: 0644]
philter/philter/install.d/config.inc.php
philter/philter/locales/plugins/addhdr.en.inc.php [new file with mode: 0644]
philter/philter/locales/plugins/addhdr.fr.inc.php [new file with mode: 0644]

diff --git a/philter/philter/include/plugin_addheader.inc.php b/philter/philter/include/plugin_addheader.inc.php
new file mode 100644 (file)
index 0000000..2455283
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+/********************************************************************************
+* include/plugin_forward.inc.php : The class for forwards
+* ------------------------------
+*
+* This file is part of the philter distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+class AddHdrPlugin extends ActionPlugin {
+    function AddHdrPlugin() { $this->ActionPlugin(); }
+    function rtti() { return 3; }
+    function name() { return _i18n('3_add_hdr'); }
+
+    function to_js() {
+        return <<<EOF
+function(Node, data) {
+    var i,j;
+    var sel = 0;
+    
+    Node.appendChild(document.createElement('br'));
+    Node.appendChild(document.createTextNode('X-'));
+    
+    var hdr_i = document.createElement('input');
+    hdr_i.setAttribute('type', 'text');
+    hdr_i.setAttribute('name', Node.name+'[1]');
+    hdr_i.setAttribute('value', (data[1] ? data[1] :'') );
+    Node.appendChild(hdr_i);
+    
+    Node.appendChild(document.createTextNode(': '));
+    
+    var val_i = document.createElement('input');
+    val_i.setAttribute('type', 'text');
+    val_i.setAttribute('name', Node.name+'[2]');
+    val_i.setAttribute('value', (data[2] ? data[2] :'') );
+    Node.appendChild(val_i);
+}
+EOF;
+    }
+
+    function to_string($_data) {
+        return "    xfilter \"reformail -A 'X-"
+            .addslashes($_data[1]).": "
+            .addslashes($_data[2])."'\"\n";
+    }
+}
+
+/********************************************************************************
+* $Id$
+* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
+********************************************************************************/
+?>
index 494ae8e..638f92a 100644 (file)
@@ -36,6 +36,7 @@ $philter->register_plugin(new CustHdrPlugin(false));
 
 $philter->register_plugin(new FwdPlugin());
 $philter->register_plugin(new AutoReplyPlugin());
+$philter->register_plugin(new AddHdrPlugin());
 
 /********************************************************************************
 * $Id$
diff --git a/philter/philter/locales/plugins/addhdr.en.inc.php b/philter/philter/locales/plugins/addhdr.en.inc.php
new file mode 100644 (file)
index 0000000..fd7f8ca
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+/********************************************************************************
+* i18n file
+*
+* This file is part of the philter distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+$philter->config['i18n']['3_add_hdr'] = 'Add Header';
+
+/********************************************************************************
+* $Id$
+* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
+********************************************************************************/
+?>
diff --git a/philter/philter/locales/plugins/addhdr.fr.inc.php b/philter/philter/locales/plugins/addhdr.fr.inc.php
new file mode 100644 (file)
index 0000000..5e6be1d
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+/********************************************************************************
+* i18n file
+*
+* This file is part of the philter distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+$philter->config['i18n']['3_add_hdr'] = 'Ajouter entĂȘte';
+
+/********************************************************************************
+* $Id$
+* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
+********************************************************************************/
+?>