header match plugin
authorPierre Habouzit <madcoder@debian.org>
Fri, 12 Sep 2003 06:56:17 +0000 (06:56 +0000)
committerPierre Habouzit <madcoder@debian.org>
Fri, 12 Sep 2003 06:56:17 +0000 (06:56 +0000)
philter/philter/include/plugin_header.inc.php [new file with mode: 0644]
philter/philter/install.d/config.inc.php
philter/philter/locales/philter.en.inc.php
philter/philter/locales/philter.fr.inc.php
philter/philter/locales/plugins/header.en.inc.php [new file with mode: 0644]
philter/philter/locales/plugins/header.fr.inc.php [new file with mode: 0644]

diff --git a/philter/philter/include/plugin_header.inc.php b/philter/philter/include/plugin_header.inc.php
new file mode 100644 (file)
index 0000000..9771eaa
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+/********************************************************************************
+* include/plugin_header.inc.php : The class for Header Based Match
+* -----------------------------
+*
+* This file is part of the philter distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+class HdrPlugin extends MatchPlugin {
+    function HdrPlugin($glob) { $this->MatchPlugin(false); }
+    function rtti() { return 2; }
+    function name() { return _i18n('2_hdr'); }
+
+    function to_js() {
+        return
+"function(Node, data) {
+    var i,j;
+    var sel = 0;
+    
+    Node.appendChild(document.createTextNode(' '));
+    
+    var hdr_s = document.createElement('select');
+    hdr_s.setAttribute('name', Node.name+'[1]');
+    Node.appendChild(hdr_s);
+
+    hdr_s.options[0] = new Option('<"._i18n('2_dests').">',0,false,data[1]==0);
+    hdr_s.options[1] = new Option('Subject:',1,false,data[1]==1);
+    hdr_s.options[2] = new Option('From:',2,false,data[1]==2);
+    hdr_s.options[3] = new Option('To:',3,false,data[1]==3);
+    hdr_s.options[4] = new Option('Cc:',4,false,data[1]==4);
+    hdr_s.options[5] = new Option('Reply-To:',5,false,data[1]==5);
+    hdr_s.options[6] = new Option('Organization:',6,false,data[1]==6);
+    hdr_s.options[7] = new Option('List-Id:',7,false,data[1]==7);
+    hdr_s.options[8] = new Option('X-Mailing-List:',8,false,data[1]==8);
+    hdr_s.options[9] = new Option('<"._i18n('2_daemon').">',9,false,data[1]==9);
+    hdr_s.selectIndex = data[1];
+    
+    var op_s = document.createElement('select');
+    op_s.setAttribute('name', Node.name+'[2]');
+    Node.appendChild(op_s);
+
+    op_s.options[0] = new Option('"._i18n('2_contains')."',0,false,data[2]==0);
+    op_s.options[1] = new Option('"._i18n('2_not_contains')."',1,false,data[2]==1);
+    op_s.options[2] = new Option(' = ',2,false,data[2]==2);
+    op_s.options[3] = new Option(' != ',3,false,data[2]==3);
+    op_s.options[4] = new Option(' >= ',4,false,data[2]==4);
+    op_s.options[5] = new Option(' > ',5,false,data[2]==5);
+    op_s.options[6] = new Option(' <= ',6,false,data[2]==6);
+    op_s.options[7] = new Option(' < ',7,false,data[2]==7);
+    op_s.selectIndex = data[2];
+
+    var txt_i = document.createElement('input');
+    txt_i.setAttribute('type','text');
+    txt_i.setAttribute('name', Node.name+'[3]');
+    Node.appendChild(txt_i);
+}";
+    }
+}
+
+/********************************************************************************
+* $Id$
+* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
+********************************************************************************/
+?>
index 4ba27be..bad906d 100644 (file)
@@ -31,6 +31,8 @@ $philter->config['path']['spool']    = "/var/spool/philter";
 
 $philter->register_global_plugin(new BogoPlugin(true));
 
+$philter->register_plugin(new HdrPlugin(false));
+
 $philter->register_plugin(new FwdPlugin());
 $philter->register_plugin(new AutoReplyPlugin());
 
index 2dd7d9a..31f3247 100644 (file)
@@ -44,12 +44,12 @@ $philter->config['i18n'] = Array(
     
     'filter_rule_conf' => 'Global Options',
     'rule_name' => 'Name of this rule',
-    'all_matches' => 'each match must be true',
-    'one_match' => 'only one match need to be true',
-    'blocking_rule' => 'stop after this rule if matched',
+    'all_matches' => 'Match all of the following',
+    'one_match' => 'Match any of the following',
+    'blocking_rule' => 'If the filter matches, stop processing here',
     
-    'filter_matches_list' => 'Matches List',
-    'filter_actions_list' => 'Actions List',
+    'filter_matches_list' => 'Filter Criteria',
+    'filter_actions_list' => 'Filter Actions',
 
 // include/email.php
     'your_email' => 'your email ...',
index 20ffc56..8265c91 100644 (file)
@@ -83,12 +83,12 @@ $philter->config['i18n'] = Array(
     
     'filter_rule_conf' => 'Options globales',
     'rule_name' => 'Nom pour cette règle',
-    'all_matches' => 'chaque critère doit être validé',
-    'one_match' => 'un unique critère vérifié suffit',
-    'blocking_rule' => 'arrêter de filtrer après cette règle si applicable',
+    'all_matches' => 'doit correspondre à tous les critères suivants',
+    'one_match' => 'doit correspondre à au moins un des critères suivants',
+    'blocking_rule' => 'si cette règle est applicable, ne pas poursuivre',
     
-    'filter_matches_list' => 'liste des critères',
-    'filter_actions_list' => 'liste des actions',
+    'filter_matches_list' => 'Critères de filtrage',
+    'filter_actions_list' => 'Actions de la règle',
 
 // include/email.php
     'your_email' => 'ton email ...',
diff --git a/philter/philter/locales/plugins/header.en.inc.php b/philter/philter/locales/plugins/header.en.inc.php
new file mode 100644 (file)
index 0000000..8beeb18
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+/********************************************************************************
+* i18n file
+*
+* This file is part of the philter distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+$philter->config['i18n']['2_hdr'] = 'Header';
+$philter->config['i18n']['2_dests'] = 'recipients';
+$philter->config['i18n']['2_daemon'] = 'from daemon';
+$philter->config['i18n']['2_contains'] = 'contains';
+$philter->config['i18n']['2_not_contains'] = 'contains not';
+
+/********************************************************************************
+* $Id$
+* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
+********************************************************************************/
+?>
diff --git a/philter/philter/locales/plugins/header.fr.inc.php b/philter/philter/locales/plugins/header.fr.inc.php
new file mode 100644 (file)
index 0000000..0065cfd
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+/********************************************************************************
+* i18n file
+*
+* This file is part of the philter distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+$philter->config['i18n']['2_hdr'] = 'Sur Entête';
+$philter->config['i18n']['2_dests'] = 'destinataires';
+$philter->config['i18n']['2_daemon'] = 'mail de démon';
+$philter->config['i18n']['2_contains'] = 'contient';
+$philter->config['i18n']['2_not_contains'] = 'ne contient pas';
+
+/********************************************************************************
+* $Id$
+* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
+********************************************************************************/
+?>