Index: /tags/r0/debian/postrm.ex
===================================================================
--- /tags/r0/debian/postrm.ex	(revision 1262)
+++ /tags/r0/debian/postrm.ex	(revision 1262)
@@ -0,0 +1,38 @@
+#! /bin/sh
+# postrm script for alternc-fetchmail-builder
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+       purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+
+
+        ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
Index: /tags/r0/debian/preinst.ex
===================================================================
--- /tags/r0/debian/preinst.ex	(revision 1262)
+++ /tags/r0/debian/preinst.ex	(revision 1262)
@@ -0,0 +1,44 @@
+#! /bin/sh
+# preinst script for alternc-fetchmail-builder
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+#
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    install|upgrade)
+#        if [ "$1" = "upgrade" ]
+#        then
+#            start-stop-daemon --stop --quiet --oknodo  \
+#                --pidfile /var/run/alternc-fetchmail-builder.pid  \
+#                --exec /usr/sbin/alternc-fetchmail-builder 2>/dev/null || true
+#        fi
+    ;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Index: /tags/r0/debian/control
===================================================================
--- /tags/r0/debian/control	(revision 1262)
+++ /tags/r0/debian/control	(revision 1262)
@@ -0,0 +1,29 @@
+Source: alternc-procmail
+Section: unknown
+Priority: optional
+Maintainer: Benjamin Sonntag <benjamin@alternc.org>
+Build-Depends: debhelper (>> 3.0.0), gettext
+Standards-Version: 3.5.2
+
+Package: alternc-procmail
+Architecture: any
+Depends: ${shlibs:Depends}, alternc (>= 0.9.2), procmail, squirrelmail (>= 1.4)
+Description: Procmail plugin for AlternC and Squirrelmail 1.4
+ This AlternC & Squirrelmail plugin allows any user to build a procmailrc
+ file thanks to a user-friendly internationalized web interface integrated
+ into squirrelmail. Procmail is a mail filtering processor. This plugin also
+ install amavis, clamav and spamassassin to enable virus and spam filtering
+ on the server side. Postfix will be configured properly.
+ .
+ You must reconfigure Squirrelmail after the installation to enable this
+ plugin with /etc/squirrelmail/conf.pl
+Description-fr: Module Procmail pour AlternC et Squirrelmail 1.4
+ Ce module pour AlternC et Squirrelmail permet aux utilisateurs de courrier
+ electronique de filtrer leurs mails du cote du serveur grace a une interface
+ web de construction de fichier de filtre '.procmailrc'. L'interface 
+ multilingue permet aussi de filtrer les virus et spam grace a spamassassin,
+ clamav et amavis qui sont installes par ce module. Postfix est automatiquement
+ comfingure correctement.
+ .
+ Vous devez activer ce plugin dans Squirrelmail apres l'installation en 
+ lancant /etc/squirrelmail/conf.pl
Index: /tags/r0/debian/prerm.ex
===================================================================
--- /tags/r0/debian/prerm.ex	(revision 1262)
+++ /tags/r0/debian/prerm.ex	(revision 1262)
@@ -0,0 +1,39 @@
+#! /bin/sh
+# prerm script for alternc-fetchmail-builder
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|upgrade|deconfigure)
+#       install-info --quiet --remove /usr/info/alternc-fetchmail-builder.info.gz
+        ;;
+    failed-upgrade)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Index: /tags/r0/debian/dirs
===================================================================
--- /tags/r0/debian/dirs	(revision 1262)
+++ /tags/r0/debian/dirs	(revision 1262)
@@ -0,0 +1,4 @@
+/usr/share/squirrelmail/plugins/procmail_builder
+/var/alternc/bureau/class/procmail_builder
+/var/alternc/bureau/locales/fr_FR/LC_MESSAGES
+
Index: /tags/r0/debian/changelog
===================================================================
--- /tags/r0/debian/changelog	(revision 1262)
+++ /tags/r0/debian/changelog	(revision 1262)
@@ -0,0 +1,6 @@
+alternc-procmail (1.2-1) unstable; urgency=low
+
+  * Initial Release as a real debian package 
+
+ -- Benjamin Sonntag <benjamin@octopuce.com>  Tue, 09 Sep 2004 11:30:19 +0100
+
Index: /tags/r0/debian/copyright
===================================================================
--- /tags/r0/debian/copyright	(revision 1262)
+++ /tags/r0/debian/copyright	(revision 1262)
@@ -0,0 +1,24 @@
+This package was debianized by Benjamin Sonntag <benjamin@octopuce.com> on
+Sun, 18 Jan 2004 11:30:19 +0100.
+
+It was downloaded from http://www.alternc.org/
+
+Upstream Author(s): AlternC Team, see http://www.alternc.org/people
+
+Copyright:
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 2 dated June, 1991.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program;  if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+On Debian GNU/Linux systems, the text of the GPL can be found in
+/usr/share/common-licenses/GPL-2.
Index: /tags/r0/debian/docs
===================================================================
--- /tags/r0/debian/docs	(revision 1262)
+++ /tags/r0/debian/docs	(revision 1262)
@@ -0,0 +1,3 @@
+README
+TODO
+mysql.sql
Index: /tags/r0/debian/rules
===================================================================
--- /tags/r0/debian/rules	(revision 1262)
+++ /tags/r0/debian/rules	(revision 1262)
@@ -0,0 +1,89 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatibility version to use.
+export DH_COMPAT=3
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+
+	touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+	dh_testdir
+
+	# Add here commands to compile the package.
+	./dopo.sh build
+	# $(MAKE)
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+	./dopo.sh clean
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Add here commands to install the package into debian/alternc-fetchmail-builder.
+#	cp add.php config.php del.php edit.php setup.php list.php \
+#		debian/alternc-fetchmail-builder/usr/share/squirrelmail/plugins/fetchmail/
+#	cp m_fetchmail.php debian/alternc-fetchmail-builder/var/alternc/bureau/admin/plugins/fetchmail/
+#	cp -R locales/* debian/alternc-fetchmail-builder/var/alternc/bureau/locales/ 
+#	find debian/alternc-fetchmail-builder/var/alternc/bureau/locales -depth -name "CVS" -type d -exec rm {} -rf \;
+#	cp fetchmail.sh debian/alternc-fetchmail-builder/usr/lib/alternc/
+
+
+	# $(MAKE) install DESTDIR=$(CURDIR)/debian/alternc-fetchmail-builder
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+#	dh_installdebconf	
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_installinit
+	dh_installcron
+	dh_installman
+	dh_installinfo
+#	dh_undocumented
+	dh_installchangelogs 
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_makeshlibs
+	dh_installdeb
+#	dh_perl
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
Index: /tags/r0/debian/README.Debian
===================================================================
--- /tags/r0/debian/README.Debian	(revision 1262)
+++ /tags/r0/debian/README.Debian	(revision 1262)
@@ -0,0 +1,8 @@
+alternc-procmail for Debian
+------------------------------------
+
+Initial Debian packaging of alternc-procmail.
+
+ -- Benjamin Sonntag <benjamin@alternc.org>, Tue, 09 Sep 2004 11:30:19 +0100
+
+
Index: /tags/r0/debian/postinst.ex
===================================================================
--- /tags/r0/debian/postinst.ex	(revision 1262)
+++ /tags/r0/debian/postinst.ex	(revision 1262)
@@ -0,0 +1,48 @@
+#! /bin/sh
+# postinst script for alternc-fetchmail-builder
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+# quoting from the policy:
+#     Any necessary prompting should almost always be confined to the
+#     post-installation script, and should be protected with a conditional
+#     so that unnecessary prompting doesn't happen if a package's
+#     installation fails and the `postinst' is called with `abort-upgrade',
+#     `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+    configure)
+
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Index: /tags/r0/procmail_add.php
===================================================================
--- /tags/r0/procmail_add.php	(revision 1262)
+++ /tags/r0/procmail_add.php	(revision 1262)
@@ -0,0 +1,187 @@
+<?php /* Modified at 2 places by ri_once */ ?>
+<?php
+
+   chdir ("..");
+   session_start();
+
+   include_once ("procmail_builder/config.php");
+   include_once ("../config/config.php");
+   include_once ("../functions/strings.php");
+   include_once ("../functions/page_header.php");
+   include_once ("../functions/imap.php");
+
+   if (isset($plugin_change_ldappass))
+       $Messages = change_ldappass_check();
+
+   include_once ("../src/load_prefs.php");
+   displayPageHeader($color, "None");
+
+  textdomain("procmail_builder");
+
+$raction=intval($raction);
+if (!$raction) {
+	$raction=1;
+}
+
+$crittypecount=7;
+if (!is_array($crit)) {
+	$crit=array();
+}
+if (!is_array($crittext)) {
+	$crittext=array();
+}
+if ($createit && $accook=2) {
+	$newcrit=intval($newcrit);
+	$crit[]=$newcrit;
+	$a=_("procmail_crit_$newcrit");	
+	if (substr($a,strlen($a)-3)=="...") 
+		$crittext[]=$newcrittxt;
+	else 
+		$crittext[]="";
+}
+if ($dropit && $accook==2 && is_array($del)) {
+	$nc=$crit;
+	$nct=$crittext;
+	$crit=array();
+	$crittext=array();
+	for ($i=0;$i<count($nc);$i++) {
+		if (!in_array($i+1,$del)) {
+			$crit[]=$nc[$i];
+			$crittext[]=$nct[$i];
+		}
+	}
+}
+
+if ($rcreateit && $accook==2) {
+	if (!$r=$pr->buildrule($rulename,$crit,$crittext,$raction,$foldertogo,$emailto,$autoreplytxt)) {
+		$error=$er->errstr();
+	} else {
+		if ($pr->addrule($r)) {
+			$error="La règle a été ajoutée avec succès";
+			$already=1;
+			include_once("procmail_opt.php");
+			exit();
+		} else {
+			$error=$er->errstr();
+		}
+	}
+}
+
+if ($rdropit && $accook==2) {
+	$already=1;
+	include_once("procmail_opt.php");
+	exit();
+}
+
+?>
+<br>
+<form method=post action="procmail_add.php">
+<input type="hidden" name="accook" value="2">
+<table width=95% align=center cellpadding=2 cellspacing=2 border=0>
+<tr><td bgcolor="<?php echo $color[0] ?>">
+   <center><b><?php __("Create a new rule"); ?></b></center>
+</td>
+</tr>
+<?php
+
+if ($error) echo "<tr><td><b>$error</b></td></tr>";
+
+?>
+<tr><td>
+<?php __("Name of this rule"); ?> : <input type="text" name="rulename" size="20" maxlength="128" value="<?php echo str_replace("\"","&quote;",$rulename); ?>">
+</td></tr>
+<tr><td bgcolor="<?php echo $color[0] ?>">
+   <?php __("CRITERIA"); ?>
+</td></tr>
+<tr><td>
+<?php if (count($crit)==0) {
+	 __("No Criteria defined yet, all messages selected");
+} else {
+	// Liste des critères
+	echo "<table cellpadding=\"4\" cellspacing=\"0\">";
+	for($i=0;$i<count($crit);$i++) {
+		echo "<tr>";
+		echo "<td><input type=\"checkbox\" name=\"del[]\" value=\"".($i+1)."\"></td>";
+		echo "<td><select name=\"crit[$i]\">";
+		for($j=0;$j<$crittypecount;$j++)  {
+			echo "<option value=\"$j\"";
+			if ($crit[$i]==$j) echo " selected";
+			echo ">"._("procmail_crit_$j")."</option>\n";
+		}
+		echo "</select></td>";
+		echo "<td><input type=\"text\" name=\"crittext[$i]\" size=\"20\" value=\"".str_replace("\"","&quote;",$crittext[$i])."\" maxlength=\"255\"></td>";
+		echo "</tr>";
+	}
+	echo "</table>";
+}
+?>
+</td></tr>
+<tr><td>
+<hr>
+<select name="newcrit">
+<?php
+for($i=0;$i<$crittypecount;$i++)  {
+	echo "<option value=\"$i\">"._("procmail_crit_$i")."</option>\n";
+}
+?>
+</select>
+&nbsp;&nbsp;
+<input type="text" name="newcrittxt" size="20" value="" maxlength="255">&nbsp;&nbsp;
+<input type="submit" name="createit" value="<?php __("Add this new criterium"); ?>">&nbsp;
+<input type="submit" name="dropit" value="<?php __("Drop checked criteria"); ?>">&nbsp;
+</td></tr>
+<tr><td><p>&nbsp;</p></td></tr>
+<tr><td bgcolor="<?php echo $color[0] ?>">
+   <?php __("PROCESS"); ?>
+</td></tr>
+
+<tr><td>
+<table cellpadding="4" cellspacing="0">
+	<tr><td><input type="radio" name="raction" id="moveit" value="1"<?php if ($raction==1) echo " checked"; ?>></td>
+		<td><label for="moveit"><?php __("Move the message to this folder"); ?></label></td>
+		<td><select name="foldertogo"><?php
+$imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
+$boxes = sqimap_mailbox_list($imapConnection);
+
+for ($i = 0; $i < count($boxes); $i++) {
+    if (!in_array('noinferiors', $boxes[$i]['flags'])) {
+        if ((strtolower($boxes[$i]['unformatted']) == 'inbox') &&
+            $default_sub_of_inbox) {
+            $box = $boxes[$i]['unformatted'];
+            $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['unformatted-disp']);
+            echo "<OPTION SELECTED VALUE=\"$box\">$box2</option>\n";
+        } else {
+            $box = $boxes[$i]['unformatted'];
+            $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['unformatted-disp']);
+            if (strtolower($imap_server_type) != 'courier' ||
+                  strtolower($box) != "inbox.trash")
+                echo "<OPTION VALUE=\"$box\">$box2</option>\n";
+        }
+    }
+}
+
+?></select></td></tr>
+	<tr><td><input type="radio" name="raction" id="r2" value="2"<?php if ($raction==2) echo " checked"; ?>></td>
+		<td colspan="2"><label for="r2"><?php __("Filter the message through SpamAssassin"); ?></label></td></tr>
+	<tr><td><input type="radio" name="raction" id="r3" value="3"<?php if ($raction==3) echo " checked"; ?>></td>
+		<td colspan="2"><label for="r3"><?php __("Discard the message (for good !)"); ?></label></td></tr>
+	<tr><td><input type="radio" name="raction" id="r4" value="4"<?php if ($raction==4) echo " checked"; ?>></td>
+		<td><label for="r4"><?php __("Forward the mail to"); ?></label></td><td><input type="text" name="emailto" value="<?php echo str_replace("\"","&quote;",$emailto); ?>" size="30" maxlength="255"></td></tr>
+	<tr><td valign="top"><input type="radio" name="raction" id="r5" value="5"<?php if ($raction==5) echo " checked"; ?>></td>	
+		<td valign="top"><label for="r5"><?php __("Auto-reply"); ?><br><?php __("Enter auto-reply text below"); ?></label></td><td><textarea cols="32" rows="10" name="autoreplytxt"><?php echo str_replace("<","&lt;",$autoreplytxt); ?></textarea></td></tr>
+</table>
+</td></tr>
+<tr><td>
+	<input type="submit" name="rcreateit" value="<?php __("Create this rule"); ?>">&nbsp;
+	<input type="submit" name="rdropit" value="<?php __("Go back to the rule list"); ?>">&nbsp;
+</td></tr>
+
+<tr><td><p>&nbsp;</p></td></tr>
+<tr><td>
+<small><?php __("help_procmail_2"); ?></small>
+</td></tr>
+</body>
+</html>
+<?php
+textdomain("squirrelmail");
+?>
Index: /tags/r0/help.txt
===================================================================
--- /tags/r0/help.txt	(revision 1262)
+++ /tags/r0/help.txt	(revision 1262)
@@ -0,0 +1,63 @@
+
+Le procmail builder permet de construire un fichier .procmailrc dans le répertoire mail d'un compte POP.
+
+Ce .procmailrc peut ensuite être connecté sur la boite aux lettre de l'utilisateur, par la création de l'alias suivant : 
+
+loginpop_domaine.tld:	"|/usr/bin/procmail -m /data/mail/l/loginpop_domaine.tld/.procmailrc"
+
+
+Ainsi, les règles du fichier .procmailrc sont utilisées pour cette boite aux lettre.
+
+Le fichier .procmailrc est constitué ainsi : un en-tête, et un certain nombre de règles 
+
+En-tête : 
+---cut-here---
+# .procmailrc user file, filter incoming mails,
+# autogenerated from AlternC Plugin, see http://www.alternc.net for more information
+
+# PROCMAILRC HEADING
+VERBOSE=no
+MAILDIR=$HOME/Maildir/
+DEFAULT=$HOME/Maildir/
+---cut-here---
+
+
+Chaque règle est formattée comme suit : (entre les cut-here)
+---cut-here---
+# RuleType 01 -- Nom de la règle
+0:
+* From.*email@toto.com
+.folder.to.go/
+
+---cut-here---
+
+la première ligne annonce la règle, et spécifie le type de règle (2 chiffres), suivi de -- et du nom de la règle (facultatif)
+
+Les lignes suivantes sont une et une seule recette procmail constituée, comme d'habitude de : 
+	1. Une ligne d'annonce de règle (0: suivi d'eventuels flags (c f w ...))
+	2. 0 à n ligne(s) de règles à remplir, reliées par un ET logique.
+	3. Exactement 1 ligne de résultat, soit un dossier destinataire, soit un pipe (|) suivi d'un programme a lancer.
+	4. une ligne vide (\n\n)
+
+Les types de règles possibles sont : 
+
+01 : 
+- En fonction de critères (facultatifs) sur le Sujet, Destinataire, Expéditeur, ou en-tête de mail, 
+- Redirection du message vers un dossier, un email extérieur, ou suppression du message.
+- Il est possible d'arrêter le traitement des règles, ou de continuer, créant éventuellement une copie du message.
+
+02 : 
+- Lancement du client anti-spam, 
+- note : cela affecte le message, mais ne le dirige vers aucun dossier ou email particulier. Utiliser les règles suivantes pour cela.
+
+03 : 
+- En fonction de l'état du drapeau de Spam
+- Redirection du message vers un dossier, ou un email extérieur, ou suppression du message.
+- Il est possible d'arrêter le traitement des règles, ou de continuer, créant éventuellement une copie du message.
+
+04 : 
+- Réponse automatique d'absence du bureau.
+- Possibilité de spécifier le message à retourner.
+- Les expéditeur ne recevront qu'une seule fois ledit message.
+- Il est possible d'arrêter le traitement des règles, ou de continuer, créant éventuellement une copie du message.
+
Index: /tags/r0/setup.php
===================================================================
--- /tags/r0/setup.php	(revision 1262)
+++ /tags/r0/setup.php	(revision 1262)
@@ -0,0 +1,25 @@
+<?php
+
+require_once("config.php");
+
+function squirrelmail_plugin_init_procmail_builder() {
+    global $squirrelmail_plugin_hooks;
+
+    $squirrelmail_plugin_hooks['optpage_register_block']['procmail_builder'] = 'procmail_builder_optpage_register_block';
+}
+
+
+function procmail_builder_optpage_register_block() {
+    global $optpage_blocks;
+    textdomain("procmail_builder");
+    $optpage_blocks[] = array(
+        'name' => _("Filter messages"),
+        'url'  => '../plugins/procmail_builder/procmail_opt.php',
+        'desc' => _("This allow you to filter your incoming messages, setup a vacation autoreply, or filter spam with SpamAssassin"),
+        'js'   => false
+    );
+    textdomain("squirrelmail");
+}
+
+
+?>
Index: /tags/r0/m_procmail.php
===================================================================
--- /tags/r0/m_procmail.php	(revision 1262)
+++ /tags/r0/m_procmail.php	(revision 1262)
@@ -0,0 +1,567 @@
+<?php
+/*
+ $Id$
+ ----------------------------------------------------------------------
+ AlternC - Web Hosting System
+ Copyright (C) 2002 by the AlternC Development Team.
+ http://alternc.org/
+ ----------------------------------------------------------------------
+ Based on:
+ Valentin Lacambre's web hosting softwares: http://altern.org/
+ ----------------------------------------------------------------------
+ LICENSE
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License (GPL)
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ To read the license please visit http://www.gnu.org/copyleft/gpl.html
+ ----------------------------------------------------------------------
+ Original Author of file: Benjamin Sonntag
+ Purpose of file: Build a .procmailrc file for a user.
+ 	Manage ldap aliases with pipes to procmail for a user.
+ ----------------------------------------------------------------------
+*/
+
+bindtextdomain("procmail_builder", "/var/alternc/bureau/locales");
+
+// Every plugin MUST start with that require to be able to access other classes :
+
+/* GLOBAL variables accessible from local.php : 
+	$L_MYSQL_HOST="%%dbhost%%";
+	$L_MYSQL_LOGIN="%%dbuser%%";
+	$L_MYSQL_PWD="%%dbpwd%%";
+	$L_MYSQL_DATABASE="%%dbname%%";
+*/
+
+
+class m_procmail {
+
+var $clsid="procmail";	/* Every plugin has a distinct CLSID, corresponding to his error messages class. */
+var $uid=0;         /* Membre actuellement connecté */
+var $user;	    /* pop Login name */
+var $sql=array(
+   "server"        =>      "",
+   "login"        =>      "",
+   "pass"       =>      "",
+   "db"        =>      ""
+   );	/* Tableau de connection mysql */
+var $ds=-1; // MySQL Connection handle.
+
+
+/*****************************************************************************
+m_procmail() Constructeur de la classe m_procmail
+*****************************************************************************/
+function m_procmail($user="") {
+	global $L_MYSQL_HOST,$L_MYSQL_LOGIN,$L_MYSQL_PWD,$L_MYSQL_DATABASE;
+
+	$this->user=str_replace("@","_",$user);
+	$this->sql=array(
+		"server"	=>	$L_MYSQL_HOST,
+		"login"	=>	$L_MYSQL_LOGIN,
+		"pass"	=>	$L_MYSQL_PWD,
+		"db"	=>	$L_MYSQL_DATABASE
+	);
+}
+
+/*****************************************************************************
+get_status([$user]) retourne l'état de dérivation de la boite par procmail
+de l'utilisateur $user (ou de l'utilisateur courant)
+retourne 1 pour une boite dérivée, 0 pour une boite non dérivée, et false si
+une erreur s'est produite
+*****************************************************************************/
+function get_status($user="") {
+	if (!$user) $user=$this->user;
+	if (!$this->_connectsql()) {
+		$er->raise($this->clsid,1);
+		return false;
+	}
+    	$sr=ldap_search($this->ds,"dc=aliases,".$this->ldap["basedn"],"(mail=$user)",array("mail","alias"));
+	$info = ldap_get_entries($this->ds, $sr);
+	if ($info["count"]==0) {
+		return false;
+	}
+        if (substr($info[0]["alias"][0],1,1)=="|") {
+		return 1;
+	}
+	return 0;
+}
+
+/*****************************************************************************
+disable([$user]) Désactive procmail pour un utilisateur
+Ne détruit pas le jeu de règles :)
+Retourne True si tout s'est bien passé, false sinon.
+*****************************************************************************/
+function disable($user="") {
+	global $er;
+	if (!$user) $user=$this->user;
+	$u=substr($user,0,1);
+	if (!$this->_connectsql()) {
+		$er->raise($this->clsid,1);
+		return false;
+	}
+	// Destroy the alias entry.
+	if (!ldap_delete($this->ds,"mail=$user,dc=aliases,".$this->ldap["basedn"])) {
+		$er->raise($this->clsid,3,ldap_error($this->ds));
+	}
+	// Create the standard alias entry
+	$res=array(
+                 "mail" => $user,
+                 "alias" => "/var/alternc/mail/".$u."/".$user."/Maildir/",
+                 "objectclass" => "alias",
+                 );
+	if (!ldap_add($this->ds, "mail=".$user.",dc=aliases,".$this->ldap["basedn"], $res)) {
+		$er->raise($this->clsid,3,ldap_error($this->ds));
+        }
+	return true;
+}
+
+/*****************************************************************************
+enable([$user]) Active procmail pour un utilisateur
+Construit le jeu de règles par défaut si besoin :)
+Retourne True si tout s'est bien passé, false sinon.
+*****************************************************************************/
+function enable($user="") {
+	global $er;
+	if (!$user) $user=$this->user;
+	if (!$this->_connectsql()) {
+		$er->raise($this->clsid,1);
+		return false;
+	}
+	$u=substr($user,0,1);
+	// 1. on vérifie qu'un .procmailrc existe, sinon on crée le .procmailrc par défaut.
+	if (!file_exists("/var/alternc/mail/$u/$user/.procmailrc")) {
+		$f=fopen("/var/alternc/mail/$u/$user/.procmailrc","wb");
+		fputs($f,str_replace("%%HOME%%","/var/alternc/mail/$u/$user",join("",file("/var/alternc/bureau/class/procmail_builder/procmailrc.default"))));
+		fclose($f);
+	}
+	$res=array("mail" => $user, "objectclass" => "alias", "alias"=>"\"|/usr/bin/procmail -m /var/alternc/mail/$u/$user/.procmailrc\"");
+	// Destroy the alias entry.
+	if (!ldap_delete($this->ds,"mail=$user,dc=aliases,".$this->ldap["basedn"])) {
+		$er->raise($this->clsid,3,ldap_error($this->ds));
+	}
+	if (!ldap_add($this->ds,"mail=$user,dc=aliases,".$this->ldap["basedn"],$res)) {
+		$er->raise($this->clsid,3,ldap_error($this->ds));
+		return false;
+	}
+	return true;
+}
+
+
+/*****************************************************************************
+readrules([$user]) Lit le fichier procmailrc d'un utilisateur et retourne
+les règles qu'il contient sous la forme d'un tableau ordonné de règle.
+Chaque règle est un tableau associatif de la forme : 
+$c[$i]["type"]=Type de la règle (numéro)
+$c[$i]["name"]=Nom de la règle (texte)
+$c[$i]["count"]=Nombre de lignes dans la regle
+$c[$i]["rule"][0-n]=Ligne de la règle
+peut retourner un tableau vide (pas de règles) ou false si le fichier
+.procmailrc n'existe pas ou est incorrectement formatté.
+	(note : contient un automate de lecture de .procmailrc.)
+*****************************************************************************/
+function readrules($user="") {
+	global $er;
+	if (!$user) $user=$this->user;
+	$u=substr($user,0,1);
+	if (!file_exists("/var/alternc/mail/$u/$user/.procmailrc")) {
+		$er->raise($this->clsid,6);
+		return false;
+	}
+	$f=fopen("/var/alternc/mail/$u/$user/.procmailrc","rb");
+	$state=0;	$rulenum=0;	$ligne=0;
+	$res=array();
+	while (!feof($f)) {
+		$found=false; // found permet de savoir si on a trouvé qqchose à chaque tour.
+		$s=fgets($f,1024);
+		$s=trim($s);
+		if ($state==1 && !ereg("^# RuleEnd$",$s)) {
+                        $res[$rulenum]["rule"][$res[$rulenum]["count"]++]=$s;
+                        $found=true;
+                }
+                if ($state==1 && ereg("^# RuleEnd$",$s)) { // $
+                        $state=0;
+                        $rulenum++;
+                        $found=true;
+                }
+		if ($state==0 && ereg("^# RuleType ([0-9][0-9]) -- (.*)?$",$s,$r)) {
+			$state=1;
+			$res[$rulenum]["type"]=$r[1];
+			$res[$rulenum]["name"]=$r[2];
+			$res[$rulenum]["count"]=0;
+			$found=true;
+		}
+		if (!$found && $state!=0) {
+			$er->raise($this->clsid,5,$ligne);
+			return false;
+		}
+		$ligne++;
+	}
+	fclose($f);
+	return $res;
+}
+
+/*****************************************************************************
+writerules($rule,[$user]) Ecrit le fichier procmailrc d'un utilisateur en prenant
+le tableau de règle en paramètre. Remplit le .procmailrc avec le fichier
+par défaut, suivi des règles dans l'ordre du tableau.
+retourne false si le fichier .procmailrc n'existe pas déjà.
+retourne true si tout va bien.
+*****************************************************************************/
+function writerules($res,$user="") {
+	global $er;
+	if (!$user) $user=$this->user;
+	$u=substr($user,0,1);
+	if (!file_exists("/var/alternc/mail/$u/$user/.procmailrc")) {
+		$er->raise($this->clsid,6);
+		return false;
+	}
+	$f=fopen("/var/alternc/mail/$u/$user/.procmailrc","wb");
+	fputs($f,str_replace("%%HOME%%","/var/alternc/mail/$u/$user",join("",file("/var/alternc/bureau/class/procmail_builder/procmailrc.default"))));
+	for($i=0;$i<count($res);$i++) {
+		$res[$i]["name"]=trim(str_replace("\r","",str_replace("\n","",$res[$i]["name"])));
+		fputs($f,"# RuleType ".sprintf("%02d",$res[$i]["type"])." -- ".$res[$i]["name"]."\n");
+		for($j=0;$j<$res[$i]["count"];$j++) {
+			fputs($f,$res[$i]["rule"][$j]."\n");
+		}
+		fputs($f,"# RuleEnd\n\n");
+	}
+	fclose($f);
+	return true;
+}
+
+/*****************************************************************************
+addrule($rule,[$user]) Ajout la regle $rule au fichier procmailrc
+d'un utilisateur retourne false si le fichier .procmailrc n'existe pas déjà.
+retourne true si tout va bien.
+*****************************************************************************/
+function addrule($rule,$user="") {
+	global $er;
+	if (!$user) $user=$this->user;
+	$u=substr($user,0,1);
+	if (!file_exists("/var/alternc/mail/$u/$user/.procmailrc")) {
+		$er->raise($this->clsid,6);
+		return false;
+	}
+	$f=fopen("/var/alternc/mail/$u/$user/.procmailrc","ab");
+	$rule["name"]=trim(str_replace("\r","",str_replace("\n","",$rule["name"])));
+	fputs($f,"# RuleType ".sprintf("%02d",$rule["type"])." -- ".$rule["name"]."\n");
+	for($j=0;$j<$rule["count"];$j++) {
+		fputs($f,$rule["rule"][$j]."\n");
+	}
+	fputs($f,"# RuleEnd\n\n");
+	fclose($f);
+	return true;
+}
+
+/*****************************************************************************
+buildrule($crit,$crittext,$raction,$foldertogo,$emailto,$autoreplytxt,[$user]) 
+Construit la règle basée sur les critères de formulaire passés en paramètre.
+*****************************************************************************/
+function buildrule($rulename,$crit,$crittext,$raction,$foldertogo,$emailto,$autoreplytxt,$user="") {
+	global $er;
+	if (!$user) $user=$this->user;
+	$u=substr($user,0,1);
+	$mail=$user;
+	if ($c=strrpos($mail,"_")) {
+		$mail=substr($mail,0,$c)."@".substr($mail,$c+1);
+	}
+	// Vérification de la monovalence de Spam, Forward et AutoReply
+	if ($raction==2 || $raction==4 || $raction==5) {
+		$r=$this->readrules($user);
+		for($a=0;$a<count($r);$a++) {
+			if ($r[$a]["type"]==$raction) {
+				$er->raise($this->clsid,9);
+				return false;
+			}
+		}
+	}
+	$r=array();
+	$r["type"]=$raction;
+	$r["name"]=str_replace("\n","",trim($rulename));
+	if (!$r["name"]) $r["name"]="-";
+	$r["count"]=0;
+	switch ($raction) {
+	case 2:
+		$r["rule"][$r["count"]++]=":0 fw";
+		break;
+	case 4:
+		$r["rule"][$r["count"]++]=":0 c";
+		break;
+	case 5:
+		$r["rule"][$r["count"]++]=":0 Whc: /var/alternc/mail/$u/$user/$user.lock";
+		break;
+	default:
+		$r["rule"][$r["count"]++]=":0";
+		break;
+	}
+
+	for($j=0;$j<count($crit);$j++) {
+		$tt=str_replace(array("\n","?",".","*","+"),
+                                array("","\\?","\\.","\\*", "\\+"),
+                	        $crittext[$j]);
+
+		switch ($crit[$j]) {
+		case 0:
+			$s="* ^Subject.*$tt";
+			break;
+		case 1:
+			$s="* ^From.*$tt";
+			break;
+		case 2:
+			$s="* ^TO_$tt";
+			break;
+		case 3:
+			$s="* ^List-Post: $tt";
+			break;
+		case 4:
+			$s="* ^List-Id: $tt";
+			break;
+		case 5:
+			$s="* ^X-Spam-Status: Yes";
+			break;
+		case 6:
+			$s="* ^Delivered-To:.*$tt";
+			break;
+		}
+	$r["rule"][$r["count"]++]=$s;
+	} // for criteria.
+
+
+	switch ($raction) {
+	case 1:
+		//$r["rule"][$r["count"]++]=str_replace(" ","\\ ",substr($foldertogo,5))."/";
+		$r["rule"][$r["count"]++]=".".str_replace(array("\\\\"," "),array("\\","\\ "),addslashes(quotemeta(substr($foldertogo,6))))."/";
+		break;
+	case 2:
+		$r["rule"][$r["count"]++]="| /usr/bin/spamc";
+		break;
+	case 3:
+		$r["rule"][$r["count"]++]="/dev/null";
+		break;
+	case 4:
+		if (checkmail($emailto)) {
+			$er->raise($this->clsid,10);
+			return false;
+		}
+		$r["rule"][$r["count"]++]='|$SENDMAIL -oi '.$emailto;
+		break;
+	case 5:
+		$r["rule"][$r["count"]++]="* !^FROM_DAEMON";
+		$r["rule"][$r["count"]++]="* !^X-Loop: $mail";
+		$r["rule"][$r["count"]++]="| formail -rD 8192 /var/alternc/mail/$u/$user/$user.list";
+		$r["rule"][$r["count"]++]="";
+		$r["rule"][$r["count"]++]=":0 ehc";
+		$r["rule"][$r["count"]++]="| (formail -rtI\"Precedence: junk\" -I\"From: <$mail>\" -A\"X-Loop: $mail\" ; cat /var/alternc/mail/$u/$user/$user.txt) | ".'$'."SENDMAIL -oi -t";
+		$f=fopen("/var/alternc/mail/$u/$user/$user.txt","wb");
+		fputs($f,$autoreplytxt);
+		fclose($f);
+		@unlink("/var/alternc/mail/$u/$user/$user.list");
+		@unlink("/var/alternc/mail/$u/$user/$user.lock");
+	}
+	$r["rule"][$r["count"]++]="";
+	return $r;
+}
+
+/*****************************************************************************
+uprule($rules,$i) Remonte d'un cran la $i-ème règle du tableau de
+règle $rules retourne true si tout va bien. ($i>0)
+*****************************************************************************/
+function uprule($res,$i) {
+	global $er;
+	$i=intval($i);
+	if (count($res)<$i || $i==0) {
+		$er->raise($this->clsid,7);
+		return false;
+	}
+	$t=$res[$i];
+	$res[$i]=$res[$i-1];
+	$res[$i-1]=$t;
+	return $res;
+}
+
+/*****************************************************************************
+downrule($rules,$i) Descend d'un cran la $i-ème règle du tableau de
+règle $rules retourne true si tout va bien.
+*****************************************************************************/
+function downrule($res,$i) {
+	global $er;
+	$i=intval($i);
+	if ((count($res)-1)<$i) {
+		$er->raise($this->clsid,7);
+		return false;
+	}
+	$t=$res[$i];
+	$res[$i]=$res[$i+1];
+	$res[$i+1]=$t;
+	return $res;
+}
+
+/*****************************************************************************
+describe($rule) Retourne un text dans la langue courante décrivant la règle
+$rule passée en paramètre.
+*****************************************************************************/
+function describe($rule) {
+	$s="";
+
+	// Lecture des conditions : 
+	$cond=array();
+	switch ($rule["type"]) {
+	case 5: 
+		$i=1;
+		while ($rule["rule"][$i]!="* !^FROM_DAEMON" && $rule["rule"][$i]!="") {
+			$cond[]=$rule["rule"][$i];
+			$i++;
+		}
+		break;
+	default:
+		$i=1;
+		while (substr($rule["rule"][$i],0,1)=="*") {
+			$cond[]=$rule["rule"][$i];
+			$i++;
+		}
+		break;
+	}
+	// On a cond, on le parse :)
+	if (count($cond)) {
+		$s.="<small>";
+	}
+	for($i=0;$i<count($cond);$i++) {
+		if ($i) $s.=" et ";
+		if (ereg("^\\* \\^Subject\\.\\*(.*)$",$cond[$i],$t)) {
+			$s.=_("procmail_crit_0")."&nbsp;&nbsp;<code>".str_replace("\\","",$t[1])."</code>";
+		}
+		if (ereg("^\\* \\^From\\.\\*(.*)$",$cond[$i],$t)) {
+			$s.=_("procmail_crit_1")."&nbsp;&nbsp;<code>".str_replace("\\","",$t[1])."</code>";
+		}
+		if (ereg("^\\* \\^TO_(.*)$",$cond[$i],$t)) {
+			$s.=_("procmail_crit_2")."&nbsp;&nbsp;<code>".str_replace("\\","",$t[1])."</code>";
+		}
+		if (ereg("^\\* \\^List-Post: (.*)$",$cond[$i],$t)) {
+			$s.=_("procmail_crit_3")."&nbsp;&nbsp;<code>".str_replace("\\","",$t[1])."</code>";
+		}
+		if (ereg("^\\* \\^List-Id: (.*)$",$cond[$i],$t)) {
+			$s.=_("procmail_crit_4")."&nbsp;&nbsp;<code>".str_replace("\\","",$t[1])."</code>";
+		}
+		if (ereg("^\\* \\^X-Spam-Status: Yes$",$cond[$i])) {
+			$s.=_("procmail_crit_5");
+		}
+		if (ereg("^\\* \\^Delivered-To:\\.\\*(.*)$",$cond[$i],$t)) {
+			$s.=_("procmail_crit_6")."&nbsp;&nbsp;<code>".str_replace("\\","",$t[1])."</code>";
+		}
+		$s.="<br>\n";
+	}
+	if (count($cond)) {
+		$s.="</small>";
+	}
+	$s.="--&gt; ";
+	// Action :
+	switch ($rule["type"]) {
+	case 1: 
+		$t=$rule["rule"][count($rule["rule"])-2];
+		$s.=_("Move the message to this folder")." &nbsp; <code>INBOX".substr($t,0,strlen($t)-1)."</code>";
+		break;
+	case 2:
+		$s.=_("Filter the message through SpamAssassin");
+		break;
+	case 3:
+		$s.=_("Discard the message (for good !)");
+		break;
+	case 4:
+		$t=$rule["rule"][count($rule["rule"])-2];
+		$s.=_("Forward the mail to")." &nbsp; <code>".substr($t,15)."</code>";   
+		break;
+	case 5:
+		$s.=_("Auto-reply");
+		break;
+	}
+	return $s;
+}
+
+function _connectsql() {
+	if ($this->ds==-1) {
+		if (!($this->ds=mysql_connect($this->sql["server"],$this->sql["login"],$this->sql["pass"]))) {
+			$this->ds=-1;
+			return false;
+		}
+		if (!(mysql_select_db($this->sql["db"],$this->ds))) {
+			mysql_close($ds);
+			$this->ds=-1;
+			return false;
+		}
+		return true;
+	} else return true;
+}
+
+} // CLASS
+
+/*
+
+Procmail sample rules :
+
+# PROCMAILRC HEADING
+VERBOSE=no
+MAILDIR=$HOME/Maildir/
+DEFAULT=$HOME/Maildir/
+
+# RULETYPE 1 Filtrage sur l'expéditeur du mail
+:0
+* ^From.*www-data@sinerj.org
+.Globenet.No-Log/
+
+# RULETYPE 2 Filtrage sur le destinataire du mail
+:0
+* ^TO_frnog@frnog.org
+.Listes.frnog/
+
+# RULETYPE 3 Filtrage sur un List-Id
+:0
+* List-Id: <interne_lafil.org@lafil.org>
+.Listes.interne_lafil/
+
+# RULETYPE 4 Filtrage sur un List-Post
+:0
+* List-Post: <mailto:rv-sources@rezo.net>
+.Listes.voltaire/
+
+# RULETYPE 5 Filtrage sur l'expéditeur ET le destinataire
+:0
+* ^From.*root@lautre.net
+* To: root@lautre.net
+.Lautre\ Net.logs/
+
+# RULETYPE 6 Filtrage sur le sujet du mail
+:0
+* ^Subject.*creation du compte
+.Lautre\ Net.create-delete/
+
+# RULETYPE 7 Filtrage sur le sujet ET le destinataire du mail
+:0
+* ^Subject.*changement mail inscription
+* ^TO_root@lautre.net
+.Lautre\ Net.create-delete/
+
+# RULETYPE 8 Filtrage sur le sujet ET l'expéditeur du mail
+:0
+* ^Subject.*GROS
+* ^From.*root@sinerj.org
+.Globenet.No-Log/
+
+
+# RULETYPE 9 Filtrage anti-spam
+:0fw
+| /usr/bin/spamc
+
+:0
+* ^X-Spam-Status: Yes
+.zz\ spam/
+
+*/
+
+?>
Index: /tags/r0/procmail_builder.po
===================================================================
--- /tags/r0/procmail_builder.po	(revision 1262)
+++ /tags/r0/procmail_builder.po	(revision 1262)
@@ -0,0 +1,159 @@
+# French AlternC Translation,
+# Procmail builder plugin
+# Copyright (c) 2002 the AlternC Development Team
+# <tech@alternc.org>
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: $Id$\n"
+"POT-Creation-Date: 2003-01-27 21:00CEST\n"
+"PO-Revision-Date: 2003-01-27 21:00CEST\n"
+"Last-Translator: Benjamin Sonntag <benjamin@octopuce.com>\n"
+"Language-Team: French <tech@alternc.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "err_procmail_1"
+msgstr "Connection ldap impossible. Reessayez plus tard."
+
+msgid "err_procmail_2"
+msgstr "Le filtrage est déjà désactivé sur ce compte"
+
+msgid "err_procmail_3"
+msgstr "-- Erreur de Serveur -- Impossible d'accéder à LDAP ! (%s)"
+
+msgid "err_procmail_4"
+msgstr "Le filtrage est déjà activé sur ce compte"
+
+msgid "err_procmail_5"
+msgstr "Erreur dans le fichier .procmailrc, ligne %s. Contactez l'administrateur"
+
+msgid "err_procmail_6"
+msgstr "Aucune règle de filtrage actuellement, les messages sont envoyés dans le dossier INBOX"
+
+msgid "err_procmail_7"
+msgstr "Impossible de remonter la règle demandée."
+
+msgid "err_procmail_8"
+msgstr "Impossible de descendre la règle demandée."
+
+msgid "err_procmail_9"
+msgstr "Vous ne pouvez créer qu'une seule règle SpamAssassin, Transmettre ou Réponse automatique."
+
+msgid "err_procmail_10"
+msgstr "L'email à qui transmettre est incorrect"
+
+msgid "Filter Messages"
+msgstr "Filtrer les messages"
+
+msgid "This allow you to filter your incoming messages, setup a vacation autoreply, or filter spam with SpamAssassin"
+msgstr "Vous permet de filtrer vos messages entrants, fixer un répondeur automatique, ou filtrer les spams grace à SpamAssassin"
+
+msgid "Your mailbox filter is enabled"
+msgstr "Le filtrage de vos messages est actif"
+
+msgid "Click here to disable the filters"
+msgstr "Cliquez ici pour le désactiver"
+
+msgid "Your mailbox filter is disabled"
+msgstr "Le filtrage de vos messages est inactif"
+
+msgid "Click here to enable the filters"
+msgstr "Cliquez ici pour l'activer"
+
+msgid "Current filter rules on your mailbox"
+msgstr "Liste des règles de filtrage de votre boite aux lettres"
+
+msgid "Message sent to INBOX folder"
+msgstr "Envoyer les messages dans le dossier INBOX"
+
+msgid "Delete checked rules"
+msgstr "Effacer les règles cochées"
+
+msgid "Create a new rule"
+msgstr "Définir une nouvelle règle"
+
+msgid "Your mail filters has been disabled"
+msgstr "Vos filtres de mails ont été désactivés"
+
+msgid "Your mail filters has been enabled"
+msgstr "Vos filtres de mails ont été activés"
+
+msgid "help_procmail_1"
+msgstr "-"
+
+msgid "help_procmail_2"
+msgstr ""
+"Une règle fonctionne ainsi : lorsque tous les CRITERES sont remplis,     "
+"le message subit l'ACTION. Il est possible de ne mettre aucun critère,   "
+"dans ce cas, tous les messages passant par cette règle subiront l'ACTION "
+
+msgid "CRITERIA"
+msgstr "CRITERES"
+
+msgid "PROCESS"
+msgstr "ACTION"
+
+msgid "Move the message to this folder"
+msgstr "Déplace le message dans le dossier"
+
+msgid "Filter the message through SpamAssassin"
+msgstr "Filtrer le message à travers SpamAssassin"
+
+msgid "Discard the message (for good !)"
+msgstr "Détruire le message (définitivement !)"
+
+msgid "Auto-reply"
+msgstr "Répondre automatiquement"
+
+msgid "Enter auto-reply text below"
+msgstr "Entrez le texte de réponse à coté"
+
+msgid "Forward the mail to"
+msgstr "Transmettre le message à"
+
+msgid "Create this rule"
+msgstr "Créer cette règle"
+
+msgid "Go back to the rule list"
+msgstr "Retour à la liste des règles"
+
+msgid "Add this new criterium"
+msgstr "Ajouter ce critère"
+
+msgid "Drop checked criteria"
+msgstr "Effacer les critères cochés"
+
+msgid "No Criteria defined yet, all messages selected"
+msgstr "Aucun critère de défini, tous les messages sont concernés par cette règle"
+
+msgid "procmail_crit_0"
+msgstr "Le sujet du message contient ..."
+
+msgid "procmail_crit_1"
+msgstr "L'expéditeur du message est contient ..."
+
+msgid "procmail_crit_2"
+msgstr "L'un des destinataires du message contient ..."
+
+msgid "procmail_crit_3"
+msgstr "L'en-tete 'List-Post' du message est ..."
+
+msgid "procmail_crit_4"
+msgstr "L'en-tete 'List-Id' du message est ..."
+
+msgid "procmail_crit_5"
+msgstr "SpamAssassin considère qu'il s'agit d'un Spam"
+
+msgid "procmail_crit_6"
+msgstr "L'en-tete 'Delivered-To' du message contient ..."
+
+msgid "Name of this rule"
+msgstr "Nom de la règle"
+
+msgid "Up"
+msgstr "Monter"
+
+msgid "Down"
+msgstr "Descendre"
Index: /tags/r0/dopo.sh
===================================================================
--- /tags/r0/dopo.sh	(revision 1262)
+++ /tags/r0/dopo.sh	(revision 1262)
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+MO="`echo $1|sed -e 's/po$/mo/'`"
+msgfmt -v -v $1 -o $MO
+rm $1
Index: /tags/r0/config.php
===================================================================
--- /tags/r0/config.php	(revision 1262)
+++ /tags/r0/config.php	(revision 1262)
@@ -0,0 +1,16 @@
+<?php
+
+bindtextdomain("procmail_builder", "/var/alternc/bureau/locales");
+
+$do_not_set_lang_env=1;
+$root="/var/alternc/bureau/";
+
+require_once($root."class/local.php");
+require_once($root."class/functions.php");
+require_once($root."admin/plugins/procmail_builder/m_procmail.php");
+require_once($root."class/m_err.php");
+
+$pr=new m_procmail($username);
+$er=new m_err();
+
+?>
Index: /tags/r0/README
===================================================================
--- /tags/r0/README	(revision 1262)
+++ /tags/r0/README	(revision 1262)
@@ -0,0 +1,28 @@
+AlternC Plugin for Squirrelmail
+----------------------------------------
+
+This is a Squirrelmail plugin to interact
+with AlternC Classes and allow the customization of 
+a user's mailbox account.
+
+It containe the procmail builder, a programm that allow
+end-user to create procmail recipes from squirrelmail, with
+a user-friendly web interface.
+
+Then the .procmailrc file can start filtering messages,
+through spamassassin, or vacation, or any other safe
+procmail recipes.
+
+--CHANGE LOG----------------------------
+
+B.Sonntag, benjamin@alternc.org
+1.2, Sep 09 2004 
+- Change the name to alternc-procmail,
+- Change it to a real debian package ...
+- adaptation to squirrelmail 1.4 and alternc 0.9.2-2
+
+B.Sonntag, benjamin@octopuce.com
+1.1, Jan 28 2003 - Many bugfixes and interface improvement.
+
+B.Sonntag, benjamin@octopuce.Com
+1.0, Jul 21 2002 - Initial Version
Index: /tags/r0/procmail_opt.php
===================================================================
--- /tags/r0/procmail_opt.php	(revision 1262)
+++ /tags/r0/procmail_opt.php	(revision 1262)
@@ -0,0 +1,146 @@
+<?php
+   /*
+    *  AlternC Procmail managment
+    *
+    */
+if ($accook==1 && $addnew) {
+	include_once("procmail_add.php");
+	exit();
+}
+
+if (!$already) {
+   chdir ("..");
+   session_start();
+
+   include_once ("procmail_builder/config.php");
+   include_once ("../config/config.php");
+   include_once ("../functions/strings.php");
+   include_once ("../functions/page_header.php");
+   include_once ("../functions/imap.php");
+
+   include_once ("../src/load_prefs.php");
+   displayPageHeader($color, "None");
+}
+
+  textdomain("procmail_builder");
+
+// submit :) let's DO something
+if ($accook==1) {
+	$error="";
+	if ($disable) {
+		if ($pr->disable()) 
+			$error=_("Your mail filters has been disabled");
+		else 
+			$error=$er->errstr();
+	}
+	if ($enable) {
+		if ($pr->enable())
+			$error=_("Your mail filters has been enabled");
+		else
+			$error=$er->errstr();
+	}
+	if ($delete && is_array($del)) {
+	$rules=$pr->readrules();
+	$r=array();
+	for($i=0;$i<count($rules);$i++) {
+		if (!in_array($i+1,$del)) {
+			$r[]=$rules[$i];
+		}
+	}
+	$pr->writerules($r);
+	}
+}
+
+?>
+
+<br>
+<form method=post action="procmail_opt.php">
+<input type="hidden" name="accook" value="1">
+<table width=95% align=center cellpadding=2 cellspacing=2 border=0>
+<tr><td bgcolor="<?php echo $color[0] ?>">
+   <center><b><?php __("Filter Messages"); ?></b></center>
+</td>
+</tr>
+<?php
+
+if ($error) echo "<tr><td><b>$error</b></td></tr>";
+
+$s=$pr->get_status();
+$rules=$pr->readrules();
+
+if ($act=="up") {
+	$t=$pr->uprule($rules,$rid);
+	if ($t!==false) {
+		$pr->writerules($t);
+		$rules=$t;
+	} else {
+		$error=$er->errstr();
+	}
+}
+if ($act=="down") {
+        $t=$pr->downrule($rules,$rid);
+        if ($t!==false) {
+                $pr->writerules($t);
+                $rules=$t;
+        } else {
+                $error=$er->errstr();
+        }
+}
+?>
+<tr><td>
+	<table cellpadding="6"><tr><td>
+	<?php if ($s) {
+		__("Your mailbox filter is enabled"); ?></td><td>
+		<input type="submit" name="disable" value="<?php __("Click here to disable the filters"); ?>">
+	<?php } else {
+		__("Your mailbox filter is disabled"); ?></td><td>
+		<input type="submit" name="enable" value="<?php __("Click here to enable the filters"); ?>">
+	<?php } ?>
+	</td></tr>
+	</table>
+</td></tr>
+<tr><td>
+<?php if (count($rules)) { ?>
+	<input type="submit" name="delete" value="<?php __("Delete checked rules"); ?>">&nbsp;&nbsp;
+<?php } ?>
+	<input type="submit" name="addnew" value="<?php __("Create a new rule"); ?>">&nbsp;&nbsp;
+</td></tr>
+<tr><td bgcolor="<?php echo $color[0] ?>">
+	<center><b><?php __("Current filter rules on your mailbox"); ?></b></center>
+</td></tr>
+<tr><td>
+<?php
+
+if ($rules===false) {
+	echo $er->errstr();
+} else {
+	echo "<table cellpadding=\"2\" cellspacing=\"0\" border=\"1\">\n";
+	for($i=0;$i<count($rules);$i++) {
+		echo "<tr>";
+		echo "<td valign=\"top\"><input type=\"checkbox\" id=\"c".($i+1)."\" name=\"del[]\" value=\"".($i+1)."\"></td>";
+		echo "<td valign=\"top\">".ife($i,"<a href=\"procmail_opt.php?rid=$i&act=up\">"._("Up")."</a>","&nbsp;")."</td>";
+		echo "<td valign=\"top\">".ife($i+1<count($rules),"<a href=\"procmail_opt.php?rid=$i&act=down\">"._("Down")."</a>","&nbsp;")."</td>";
+		echo "<td valign=\"top\"><label for=\"c".($i+1)."\">".stripslashes($pr->describe($rules[$i]))."</label></td>";
+		echo "<td valign=\"top\">".$rules[$i]["name"]."</td>";
+		echo "</tr>";
+	}
+	echo "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>--&gt; "._("Message sent to INBOX folder")."</td><td>&nbsp;</td></tr>";
+	echo "</table>";
+}
+?>
+</td></tr>
+
+
+<tr><td><p>&nbsp;</p></td></tr>
+<tr><td>
+<small><?php __("help_procmail_1"); ?></small>
+</td></tr>
+</table>
+</form>
+
+</body></html>
+<?php
+
+textdomain("squirrelmail");
+
+?>
Index: /tags/r0/procmailrc.default
===================================================================
--- /tags/r0/procmailrc.default	(revision 1262)
+++ /tags/r0/procmailrc.default	(revision 1262)
@@ -0,0 +1,8 @@
+# .procmailrc user file, filter incoming mails,
+# autogenerated from AlternC Plugin, see http://www.alternc.net for more information
+
+# PROCMAILRC HEADING
+VERBOSE=no
+MAILDIR=%%HOME%%/Maildir/
+DEFAULT=%%HOME%%/Maildir/
+
