[vhffs-dev] Re: [vhffs-dev] [svn] commit: r144 - in /trunk: vhffs-api/src/Vhffs/ vhffs-api/src/Vhffs/Services/ vhffs-backend/conf/ vhffs-backend/src/pgsql/ vhffs-panel/mail/ vhffs-panel/templates/mail/ vhffs-panel/templates/user/ vhffs-panel/user/

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


vhffs-dev@xxxxxxxxx a écrit :

Author: soda
Date: Fri Jan 27 02:37:25 2006
New Revision: 144

Log:
First fix for use spam and virus protection.
The schema has changed, only add two columns in vhffs_boxes relation. Those=
columns are boolean.
So, you have to change the configuration of the MTA to use it :-)

Bonjour,

Quelle est la nature des modifications à apporter au niveau d'exim ? Je ne trouve nul part de référence aux paquets utilisés en particulier pour l'anti-spam. Clamav + Spamassassin ? Spamassassin est efficace mais exige des configurations spécifiques en fonction des utilisateurs qui ne veulent pas forcément tous le même seuil de détection...

Merci.

Philippe


The configuration file has changed, now a <mail></mail> section exist in <s=
ervices/>
For example :
<services>
	=2E.. blblabla....
	<mail>
		use_nospam =3D yes
		use_novirus =3D yes
	</mail>
</services>

MailUser has changed, so, the user accounts can use those services.

It's here for testing only.




Modified:
   trunk/vhffs-api/src/Vhffs/Conf.pm
   trunk/vhffs-api/src/Vhffs/Services/Mail.pm
   trunk/vhffs-api/src/Vhffs/Services/MailUser.pm
   trunk/vhffs-backend/conf/vhffs.conf
   trunk/vhffs-backend/src/pgsql/create_boxes.sql
   trunk/vhffs-panel/mail/prefs.pl
   trunk/vhffs-panel/templates/mail/prefs_box.tmpl
   trunk/vhffs-panel/templates/user/mailuser.tmpl
   trunk/vhffs-panel/user/prefs.pl
   trunk/vhffs-panel/user/prefs_save.pl

Modified: trunk/vhffs-api/src/Vhffs/Conf.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-api/src/Vhffs/Conf.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Conf.pm Fri Jan 27 02:37:25 2006
@@ -736,6 +736,22 @@
	}
}
=20
+sub use_nospam
+{
+	return -1 if( ! defined $Config{"services"}{"mail"} );
+	return -1 if( ! defined $Config{"services"}{"mail"}{'use_nospam'} );
+	return 1 if( $Config{"services"}{"mail"}{'use_nospam'} eq "yes");
+	return 0;
+}
+
+sub use_novirus
+{
+	return -1 if( ! defined $Config{"services"}{"mail"} );
+	return -1 if( ! defined $Config{"services"}{"mail"}{'use_novirus'} );
+	return 1 if( $Config{"services"}{"mail"}{'use_novirus'} eq "yes");
+	return 0;
+}
+
=20
=20
1;

Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-api/src/Vhffs/Services/Mail.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm Fri Jan 27 02:37:25 2006
@@ -159,6 +159,8 @@
		}
		$self->{'boxes'}{$name}{'password'} =3D $self->{'boxes'}{$name}{'passwor=
d_hash'};
		$self->{'boxes'}{$name}{'changed'} =3D 0;
+		$self->{'boxes'}{$name}{'nospam'} =3D 1 if( $self->{'boxes'}{$name}{'nos=
pam'} eq 't' );
+		$self->{'boxes'}{$name}{'novirus'} =3D 1 if( $self->{'boxes'}{$name}{'no=
virus'} eq 't' );
=20
	}
	######### End of boxes fetching ########
@@ -211,11 +213,16 @@
	#COMMIT THE BOX PART
	foreach $name ( keys %{$self->{'boxes'}} )
	{
-		next if( ! defined $self->{'boxes'}{$name}{'password'} );
		next if( ( defined $self->{'boxes'}{'changed'}{'changed'} ) && ( $self->=
{'boxes'}{'changed'}{'changed'} =3D=3D 0 ) );
	=09
    	$request =3D $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs=
_boxes WHERE domain=3D'" . $self->{'domain'} . "' AND local_part=3D'".$name=
"'");
	    $rows =3D $request->execute;
+
+		#If boxes does not have nospam or novirus attribute
+		#so, we set t to 0
+		# This will create the attribute and initialize it
+		$self->{'boxes'}{$name}{'novirus'} =3D 0 if( ! defined( $self->{'boxes'}=
{$name}{'novirus'} ));
+		$self->{'boxes'}{$name}{'nospam'} =3D 0 if( ! defined( $self->{'boxes'}{=
$name}{'nospam'} ));
=20
		if( $rows =3D=3D 0 ) #PopBox NOT created, we must create it
		{
@@ -223,13 +230,14 @@
			my $userhash =3D Vhffs::Functions::hash_popuser( $name );
			my $passwordhash =3D "";
=20
-			$query =3D "INSERT INTO vhffs_boxes VALUES('". $self->{'domain'} ."' , =
'". $name ."' , '". $domainhash ."' , '".$self->{'boxes'}{$name}{'password'=
}=2E"' , '".$userhash."' , '')";
+			$query =3D "INSERT INTO vhffs_boxes(domain,local_part,domain_hash,passw=
ord_hash,mbox_name,password,nospam,novirus) VALUES('". $self->{'domain'} ."=
' , '". $name ."' , '". $domainhash ."' , '".$self->{'boxes'}{$name}{'passw=
ord'}."' , '".$userhash."' , '' ,'".$self->{'boxes'}{$name}{'nospam'}."' , =
'".$self->{'boxes'}{$name}{'novirus'}."')";
			$request =3D $self->{'db'}->{'DB_WRITE'}->prepare( $query );
			$request->execute;
		}
		else	#Popbox already created
		{
-			$query =3D "UPDATE vhffs_boxes SET password_hash=3D'".$self->{'boxes'}{=
$name}{'password'}."' WHERE local_part=3D'".$self->{'boxes'}{$name}{'local_=
part'}."' AND domain=3D'".$self->{'domain'}."'";
+
+			$query =3D "UPDATE vhffs_boxes SET nospam=3D'".$self->{'boxes'}{$name}{=
'nospam'}."', novirus=3D'".$self->{'boxes'}{$name}{'novirus'}."', password_=
hash=3D'".$self->{'boxes'}{$name}{'password'}."' WHERE local_part=3D'".$sel=
f->{'boxes'}{$name}{'local_part'}."' AND domain=3D'".$self->{'domain'}."'";
			$request =3D $self->{'db'}->{'DB_WRITE'}->prepare( $query );
			$request->execute;
		}
@@ -297,6 +305,45 @@
	return 1;
}
=20
+# The change_spam_status function change the status of a box=20
+# on the mail domain given in parmeter
+# If the spam removal was enable, it will be disable at next commit() on o=
bject
+sub change_spam_status
+{
+	my $self =3D shift;
+	my $local_part =3D shift;
+
+	return -1 if( ! defined $self->{'boxes'}{$local_part} );
+
+	if( ! defined( $self->{'boxes'}{$local_part}{'nospam'} ) )
+	{
+		$self->{'boxes'}{$local_part}{'nospam'} =3D 0;
+	}
+
+	$self->{'boxes'}{$local_part}{'nospam'} =3D ( ( $self->{'boxes'}{$local_p=
art}{'nospam'} + 1 ) % 2 );
+	$self->{'boxes'}{$local_part}{'changed'} =3D 1;
+	return 1;
+}
+
+
+#work as change_spam_status
+sub change_virus_status
+{
+	my $self =3D shift;
+	my $local_part =3D shift;
+
+	return -1 if( ! defined $self->{'boxes'}{$local_part} );
+
+	if( ! defined( $self->{'boxes'}{$local_part}{'novirus'} ) )
+	{
+		$self->{'boxes'}{$local_part}{'novirus'} =3D 0;
+	}
+
+	$self->{'boxes'}{$local_part}{'novirus'} =3D ( ( $self->{'boxes'}{$local_=
part}{'novirus'} + 1 ) % 2 );
+	$self->{'boxes'}{$local_part}{'changed'} =3D 1;
+	return 1;
+}
+
=20
=20
sub addforward
@@ -409,6 +456,7 @@
=20
=20
=20
+
#Following functions is needed by courier to fetch accounts
=20
sub crypt_pwd
@@ -437,6 +485,37 @@
	my $self =3D shift;
	return $self->{'domain'};
}
+
+
+
+###########################
+# ospam function only use when the mail domain
+# if fetched
+# It can explain if a box ue antispam or not
+# for example $mail->use_nospam( 'myaccount' );
+# returns 	-1 if error
+# 			0 if nospam is used
+#			1 if spam is used
+sub use_nospam
+{
+	my $self =3D shift;
+	my $box =3D shift;
+
+	return -1 if(  ! defined( $self->{'boxes'}->{$box} ) );
+	return 1 if( $self->{'boxes'}->{$box}{'nospam'} =3D=3D 1 );
+	return 0;
+}
+
+sub use_novirus
+{
+	my $self =3D shift;
+	my $box =3D shift;
+
+	return -1 if(  ! defined( $self->{'boxes'}->{$box} ) );
+	return 1 if( $self->{'boxes'}->{$box}{'novirus'} =3D=3D 1 );
+	return 0;
+}
+
=20
=20
sub get_boxespath

Modified: trunk/vhffs-api/src/Vhffs/Services/MailUser.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-api/src/Vhffs/Services/MailUser.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/MailUser.pm Fri Jan 27 02:37:25 2006
@@ -118,6 +118,33 @@
	return $self->{object}->exists_box( $self->{part} );
}
=20
+sub use_nospam
+{
+	my $self =3D shift;
+	return $self->{object}->use_nospam( $self->{part} );
+}
+
+sub use_novirus
+{
+	my $self =3D shift;
+	return $self->{object}->use_novirus( $self->{part} );
+}
+
+sub change_spam_status
+{
+	my $self =3D shift;
+	$self->{object}->change_spam_status( $self->{part} );
+	return -2 if( $self->{object}->commit < 0 );
+	return 1;
+}
+
+sub change_virus_status
+{
+	my $self =3D shift;
+	$self->{object}->change_virus_status( $self->{part} );
+	return -2 if( $self->{object}->commit < 0 );
+	return 1;
+}
=20
=20
sub addforward

Modified: trunk/vhffs-backend/conf/vhffs.conf
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-backend/conf/vhffs.conf (original)
+++ trunk/vhffs-backend/conf/vhffs.conf Fri Jan 27 02:37:25 2006
@@ -197,6 +197,10 @@
		uid	=3D	33
		gid	=3D	33
	</subversion>
+	<mail>
+		use_nospam	=3D	yes
+		use_novirus	=3D	yes
+	</mail>
	<mailuser>
		activate	=3D	yes
		domain		=3D	tuxfamily.org

Modified: trunk/vhffs-backend/src/pgsql/create_boxes.sql
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-backend/src/pgsql/create_boxes.sql (original)
+++ trunk/vhffs-backend/src/pgsql/create_boxes.sql Fri Jan 27 02:37:25 2006
@@ -6,5 +6,7 @@
	password_hash varchar NOT NULL,
	mbox_name varchar NOT NULL,
	password varchar NOT NULL,
+	nospam boolean,
+	novirus boolean,
	PRIMARY KEY (domain,local_part)
) WITH OIDS;

Modified: trunk/vhffs-panel/mail/prefs.pl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-panel/mail/prefs.pl (original)
+++ trunk/vhffs-panel/mail/prefs.pl Fri Jan 27 02:37:25 2006
@@ -32,6 +32,9 @@
my $domain =3D $cgi->param("name");
my $template;
my $subtemplate;
+my $subtemplate2;
+my $message;
+my $temp;
=20
my $templatedir =3D $vhffs->get_config->get_templatedir;
=20
@@ -111,12 +114,56 @@
	my $boxes =3D $mail->get_boxes;
	foreach( sort keys %{$boxes} )
	{
+		$temp =3D "";
		$subtemplate =3D new HTML::Template( filename =3D> $templatedir."/mail/p=
refs_box.tmpl" );
		$subtemplate->param( ACCOUNT =3D> $_ . "\@" . $mail->get_domain );
		$subtemplate->param( LOCALPART =3D> $_ );
		$subtemplate->param( TEXT_CHANGE_PASSWORD =3D> gettext( "Change Password=
" ) );
		$subtemplate->param( TEXT_DELETE =3D> gettext( "Delete this mail account=
" ) );
		$subtemplate->param( DOMAIN =3D> $mail->get_domain );
+
+
+
+
+		if( $vhffs->get_config->use_nospam =3D=3D 1 )
+		{
+			$subtemplate2 =3D new HTML::Template( filename =3D> $templatedir."/mail=
/prefs_spam.tmpl" );
+			$subtemplate2->param( LOCALPART =3D> $_ );
+			$subtemplate2->param( DOMAIN =3D> $mail->get_domain );
+			if( $mail->use_nospam( $_ ) =3D=3D 1 )
+			{
+				$message =3D gettext( "Disable anti-spam" );=09
+			}
+			else
+			{
+				$message =3D gettext( "Enable anti-spam" );=09
+			}
+			$subtemplate2->param( TEXT_SPAM =3D> $message );
+			$temp .=3D $subtemplate2->output;
+		}
+
+
+
+		if( $vhffs->get_config->use_novirus =3D=3D 1 )
+		{
+			$subtemplate2 =3D new HTML::Template( filename =3D> $templatedir."/mail=
/prefs_virus.tmpl" );
+			$subtemplate2->param( LOCALPART =3D> $_ );
+			$subtemplate2->param( DOMAIN =3D> $mail->get_domain );
+			if( $boxes->{$_}{'novirus'} =3D=3D 1 )
+			{
+					$message =3D gettext( "Disable anti-virus" );=09
+			}
+			else
+			{
+				$message =3D gettext( "Enable anti-virus" );=09
+			}
+			$subtemplate2->param( TEXT_VIRUS =3D> $message );
+			$temp .=3D $subtemplate2->output;
+		}
+
+
+
+		$subtemplate->param( OTHER =3D> $temp );
=20
		$output .=3D $subtemplate->output;
	}=09

Modified: trunk/vhffs-panel/templates/mail/prefs_box.tmpl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-panel/templates/mail/prefs_box.tmpl (original)
+++ trunk/vhffs-panel/templates/mail/prefs_box.tmpl Fri Jan 27 02:37:25 2006
@@ -11,6 +11,7 @@
			<input type=3D"submit" value=3D"<tmpl_var name=3D"TEXT_CHANGE_PASSWORD"=
" />
		</form>
	</td>
+	<tmpl_var name=3D"OTHER">
	<td>
		<form method=3D"post" action=3D"delete_box.pl">
			<input type=3D"hidden" name=3D"LOCALPART" value=3D"<tmpl_var name=3D"LO=
CALPART">" />

Modified: trunk/vhffs-panel/templates/user/mailuser.tmpl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-panel/templates/user/mailuser.tmpl (original)
+++ trunk/vhffs-panel/templates/user/mailuser.tmpl Fri Jan 27 02:37:25 2006
@@ -16,6 +16,9 @@
					<p>
						<input name=3D"mail_usage" id=3D"mail_usage_box" value=3D"1" type=3D=
"radio" <tmpl_var name=3D"POP_CHECKED">/>
						<label for=3D"mail_usage_box" ><tmpl_var name=3D"TEXT_MAILBOX"></lab=
el>
+						<ul>
+						<tmpl_var name=3D"MAILUSER_OPTIONS">
+						</ul>
					</p>
					<p>
						<input name=3D"mail_usage" id=3D"mail_usage_foward" value=3D"2" type=
=3D"radio" <tmpl_var name=3D"FWD_CHECKED">/>

Modified: trunk/vhffs-panel/user/prefs.pl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-panel/user/prefs.pl (original)
+++ trunk/vhffs-panel/user/prefs.pl Fri Jan 27 02:37:25 2006
@@ -123,8 +123,10 @@
    use Vhffs::Services::MailUser;
   =20
    my $subtemplate =3D new HTML::Template( filename =3D> $templatedir."/u=
ser/mailuser.tmpl" );
+	my $subtemplate2;
    my $config =3D $vhffs->get_config->get_service( "mailuser" );
    my $mu =3D init Vhffs::Services::MailUser( $vhffs , $user );
+	my $tmp =3D "";
=20
	if( defined $mu )
	{
@@ -137,7 +139,25 @@
    $subtemplate->param( TEXT_MAILINFO2 =3D> gettext("There is two possibl=
e usages :") );
    $subtemplate->param( TEXT_MAILBOX =3D> sprintf( gettext("Use VHFFS ser=
vers to manage this mail,<br>you should use use the host pop.%s or imap.%s =
to fetch your mails") , $config->{domain} , $config->{domain} ) );
    $subtemplate->param( TEXT_MAILFORWARD =3D> sprintf( gettext("Forward e=
mails from %s\@%s to %s"), $username, $config->{domain}, $usermail ) );
+
+	if( $vhffs->get_config->use_nospam =3D=3D 1 )
+	{
+	    $subtemplate2 =3D new HTML::Template( filename =3D> $templatedir."/us=
er/mailuserspam.tmpl" );
+	    $subtemplate2->param( TEXT_NOSPAM =3D> gettext("Use anti-spam protect=
ion") );
+	    $subtemplate2->param( ACTIV_CHECKED =3D> "checked" ) if( $mu->use_nos=
pam =3D=3D 1         );
+		$tmp .=3D $subtemplate2->output;
+	}
+
+	if( $vhffs->get_config->use_novirus =3D=3D 1 )
+	{
+    	$subtemplate2 =3D new HTML::Template( filename =3D> $templatedir."/us=
er/mailuservirus.tmpl" );
+	    $subtemplate2->param( TEXT_VIRUS =3D> gettext("Use anti-virus protect=
ion") );
+	    $subtemplate2->param( ACTIV_CHECKED =3D> "checked" ) if( $mu->use_nov=
irus =3D=3D 1         );
+		$tmp .=3D $subtemplate2->output;
+	}
+
   =20
+    $subtemplate->param( MAILUSER_OPTIONS =3D> $tmp );
    $template->param( MAILUSER =3D> $subtemplate->output );
	}
   =20

Modified: trunk/vhffs-panel/user/prefs_save.pl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-panel/user/prefs_save.pl (original)
+++ trunk/vhffs-panel/user/prefs_save.pl Fri Jan 27 02:37:25 2006
@@ -98,7 +98,7 @@
	}
	else
	{
-		$message =3D gettext("User Successfully modified");
+		$message =3D gettext("User Successfully modified") . "<br>";
	}
=09
	if( $vhffs->get_config->use_mailuser =3D=3D 1 )
@@ -106,6 +106,26 @@
		use Vhffs::Services::MailUser;
		my $mu =3D init Vhffs::Services::MailUser( $vhffs , $user );
		my $mail_activate =3D $cgi->param( "mail_activate" );
+		my $nospam =3D $cgi->param( "mail_nospam" );
+		my $novirus =3D $cgi->param( "mail_novirus" );
+		if( ( defined $nospam ) && ( $nospam eq "on" ) )
+		{
+			$nospam =3D 1;
+		}
+		else
+		{
+			$nospam =3D 0;
+		}
+		if( ( defined $novirus ) && ( $novirus eq "on" ) )
+		{
+			$novirus =3D 1;
+		}
+		else
+		{
+			$novirus =3D 0;
+		}
+
+	=09
		if( ( defined $mail_activate ) && ( $mail_activate eq "on" ) )
		{
			my $usage =3D $cgi->param( "mail_usage" );
@@ -127,6 +147,14 @@
					{
						$message =3D gettext("An error occured while adding the box");
					}
+					elsif( ( $nospam =3D=3D 1 ) && ( $mu->change_spam_status < 0 ) )
+					{
+						$message =3D gettext("An error occured while adding the box (anti-sp=
am adding)");
+					}
+					elsif( ( $novirus =3D=3D 1 ) && ( $mu->change_virus_status < 0 ) )
+					{
+						$message =3D gettext("An error occured while adding the box (anti-vi=
rus adding)");
+					}
					else
					{
						$message .=3D "<br>";
@@ -140,6 +168,61 @@
					{
						$mu->delbox;
						$mu->addbox( $pass1 );
+					}
+
+					#We change  the spam status. if the pam status change
+					if( $vhffs->get_config->use_nospam =3D=3D 1 )
+					{
+						if( ( $nospam =3D=3D 1 ) && ( $mu->use_nospam =3D=3D 0 ) )
+						{
+							if( $mu->change_spam_status =3D=3D 1 )
+							{
+								$message .=3D gettext( "Change spam protection status for your acc=
ount\n" );
+							}
+							else
+							{
+								$message .=3D gettext( "Error for spam protection\n" );
+							}
+						}
+						if( ( $nospam =3D=3D 0 ) && ( $mu->use_nospam =3D=3D 1 ) )
+						{
+							if( $mu->change_spam_status =3D=3D 1 )
+							{
+								$message .=3D gettext( "Change spam protection status for your acc=
ount\n" );
+							}
+							else
+							{
+								$message .=3D gettext( "Error for spam protection\n" );
+							}
+						}
+					}
+
+					#As spam, the virus status changes only if the user changed values
+					if( $vhffs->get_config->use_novirus =3D=3D 1 )
+					{
+						if( ( $novirus =3D=3D 1 ) && ( $mu->use_novirus =3D=3D 0 ) )
+						{
+							if( $mu->change_virus_status =3D=3D 1 )
+							{
+								$message .=3D gettext( "Change anti-virus status for your account\=
n" );
+							}
+							else
+							{
+								$message .=3D gettext( "Error for virus protection\n" );
+							}
+						}
+
+						if( ( $novirus =3D=3D 0 ) && ( $mu->use_novirus =3D=3D 1 ) )
+						{
+							if( $mu->change_virus_status  =3D=3D 1 )
+							{
+								$message .=3D gettext( "Change anti-virus status for your account\=
n" );
+							}
+							else
+							{
+								$message .=3D gettext( "Error for virus protection\n" );
+							}
+						}
					}
				}





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/