[vhffs-dev] [476] Modified a set of file to use new Mail API.

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


Revision: 476
Author:   beuss
Date:     2007-02-17 13:59:13 +0000 (Sat, 17 Feb 2007)

Log Message:
-----------
Modified a set of file to use new Mail API. Added a warn in fetch and create to log when deprecated method are used.

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mail.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm
    branches/vhffs_4.1/vhffs-panel/admin/mail/change_forward.pl
    branches/vhffs_4.1/vhffs-panel/admin/mail/delete_box.pl
    branches/vhffs_4.1/vhffs-panel/admin/mail/delete_forward.pl
    branches/vhffs_4.1/vhffs-panel/admin/mail/password_box.pl
    branches/vhffs_4.1/vhffs-panel/mail/change_forward.pl
    branches/vhffs_4.1/vhffs-panel/mail/delete.pl
    branches/vhffs_4.1/vhffs-panel/mail/delete_box.pl
    branches/vhffs_4.1/vhffs-panel/mail/delete_forward.pl
    branches/vhffs_4.1/vhffs-panel/mail/password_box.pl
    branches/vhffs_4.1/vhffs-panel/mail/prefs.pl
    branches/vhffs_4.1/vhffs-panel/mail/spambox.pl
    branches/vhffs_4.1/vhffs-panel/mail/spamvirus.pl
    branches/vhffs_4.1/vhffs-panel/mail/submit.pl
    branches/vhffs_4.1/vhffs-robots/src/create_mail.pl
    branches/vhffs_4.1/vhffs-robots/src/refused_mail.pl


Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mail.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mail.pm	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Mail.pm	2007-02-17 13:59:13 UTC (rev 476)
@@ -111,16 +111,14 @@
 
 sub create_mail
 {
-        my( $main , $domain , $user , $group ) = @_;
+        my( $main , $domain , $description, $user , $group ) = @_;
         
         return -1 if( ! defined $user );
         return -2 if( $group->fetch < 0 );
         
-        my $mail = new Vhffs::Services::Mail( $main , $domain , $user , $group );
-        $mail->set_user( $user );
-        $mail->set_group( $group );
+        my $mail = Vhffs::Services::Mail::create($main, $domain, $description, $user, $group);
 
-        return undef if ( $mail->create < 0 );
+        return undef unless ( defined $mail );
 
         return undef if ( Vhffs::Acl::add_acl( $user , $mail , Vhffs::Constants::ACL_DELETE , $main ) < 0 );
         return undef if( Vhffs::Acl::add_acl( $group , $mail , Vhffs::Constants::ACL_VIEW , $main ) < 0 );

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm	2007-02-17 13:59:13 UTC (rev 476)
@@ -107,6 +107,12 @@
 }
 
 sub create {
+    if($_[0]->isa('Vhffs::Services::Mail')) {
+        my ($package, $file, $line) = caller();
+        warn "Using deprecated form of Vhffs::Services::Mail::create from $package ($file:$line).\n";
+        return old_create(@_);
+    }
+
     return old_create(@_) if($_[0]->isa('Vhffs::Services::Mail'));
     my ($main, $domain, $description, $user, $group) = @_;
     return undef unless(defined($user) && defined($group));
@@ -166,6 +172,9 @@
 # Informations about mailboxes are stored in $ref->{'boxes'}
 sub fetch
 {
+    my ($package, $file, $line) = caller();
+    warn "Using deprecated method Vhffs::Services::Mail::fetch from $package ($file:$line).\n";
+
     my $self = shift;
     
     my ($request , $result , $name , $request2 , $result2 , $names);
@@ -620,7 +629,7 @@
 
 sub _new {
     my ($class, $main, $mxdomain_id, $owner_gid, $domain, $unix_user, $boxes_path, $max_popbox, $catchall, $oid, $owner_uid, $date_creation, $state, $description, $boxes, $forwards) = @_;
-    my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $state, $description);
+    my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state);
     return undef unless defined($self);
     
     $self->{mxdomain_id} = $mxdomain_id;

Modified: branches/vhffs_4.1/vhffs-panel/admin/mail/change_forward.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/admin/mail/change_forward.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/admin/mail/change_forward.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -65,7 +65,7 @@
 my $forward = $cgi->param("FORWARD");
 my $template;
 my $message;
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
+my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain );
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
@@ -74,17 +74,9 @@
 if( ! defined $mail )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = sprintf( gettext("Cannot instanciate object %s"), $domain );
+    $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 	$template->param( MESSAGE => $message );
 }
-elsif( $mail->fetch < 0 )
-{
-
-	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = gettext( "Cannot get informations on this object");
-	$template->param( MESSAGE => $message );
-
-}
 elsif( ( ! defined $boxname ) || ( ! defined $forward ) )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
@@ -110,18 +102,11 @@
 
 	if( ( $retour = $mail->change_forward( $boxname , $forward ) ) < 0 )
 	{
-		$message = gettext( "Can't modify forwarding" ) . "$retour , $boxname , $domain , $forward";
+        $message = sprintf(gettext('Unable to modify forward %s (%d)'), $boxname, $retour);
 	}
 	else
 	{
-		if( $mail->commit < 0 )
-		{
-			$message = gettext( "Unable to record changes on this domain" );
-		}
-		else
-		{
-			$message = gettext( "Forwarding successfully added" );
-		}
+		$message = sprintf(gettext('Forward %s successfully added'), $boxname );
 	}
 	$template->param( MESSAGE => $message );
 }

Modified: branches/vhffs_4.1/vhffs-panel/admin/mail/delete_box.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/admin/mail/delete_box.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/admin/mail/delete_box.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -64,7 +64,7 @@
 my $boxname = $cgi->param("LOCALPART");
 my $template;
 my $message;
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
+my $mail = Vhffs::Services::Mail::get_by_mxdomain($vhffs, $domain);
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
@@ -73,17 +73,9 @@
 if( ! defined $mail )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = sprintf( gettext("Cannot instanciate object %s"), $domain );
+	$message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 	$template->param( MESSAGE => $message );
 }
-elsif( $mail->fetch < 0 )
-{
-
-	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = gettext( "Cannot get information on this object");
-	$template->param( MESSAGE => $message );
-
-}
 elsif( ! defined $boxname )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );

Modified: branches/vhffs_4.1/vhffs-panel/admin/mail/delete_forward.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/admin/mail/delete_forward.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/admin/mail/delete_forward.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -64,8 +64,9 @@
 my $boxname = $cgi->param("LOCALPART");
 my $template;
 my $message;
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
 
+my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs, $domain );
+
 my $templatedir = $vhffs->get_config->get_templatedir;
 
 my $retour;
@@ -73,17 +74,9 @@
 if( ! defined $mail )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = sprintf( gettext("Cannot instanciate object %s"), $domain );
+    $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 	$template->param( MESSAGE => $message );
 }
-elsif( $mail->fetch < 0 )
-{
-
-	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = gettext( "Cannot get informations on this object");
-	$template->param( MESSAGE => $message );
-
-}
 elsif( ! defined $boxname )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
@@ -109,11 +102,11 @@
 
 	if( ( $retour = $mail->delforward( $boxname ) ) < 0 )
 	{
-		$message = "Can't delete forward $retour";
+		$message = sprintf(gettext('Unable to delete forward %s (%d)'), $boxname, $retour);
 	}
 	else
 	{
-		$message = "Succesfully delete forward";
+        $message = sprintf(gettext('Forward %s deleted'), $boxname);
 	}
 	$template->param( MESSAGE => $message );
 }

Modified: branches/vhffs_4.1/vhffs-panel/admin/mail/password_box.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/admin/mail/password_box.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/admin/mail/password_box.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -65,7 +65,7 @@
 my $password = $cgi->param("PASSWORD");
 my $template;
 my $message;
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
+my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs, $domain );
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
@@ -74,17 +74,9 @@
 if( ! defined $mail )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = sprintf( gettext("Cannot instanciate object %s"), $domain );
+    $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 	$template->param( MESSAGE => $message );
 }
-elsif( $mail->fetch < 0 )
-{
-
-	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = gettext( "Cannot get information on this object");
-	$template->param( MESSAGE => $message );
-
-}
 elsif( ( ! defined $password ) || ( ! defined $boxname ) )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
@@ -110,18 +102,11 @@
 
 	if( ( $retour = $mail->change_box_password( $boxname , $password ) ) < 0 )
 	{
-		$message = "Can't change password $boxname , $password , $retour";
+		$message = sprintf(gettext('Unable to change password for box %s (%d)'), $boxname, $retour);
 	}
 	else
 	{
-		if( $mail->commit < 0 )
-		{
-			$message = "Unable to reccord changes on this domain";
-		}
-		else
-		{
-			$message = "Sucessfully password change";
-		}
+		$message = sprintf(gettext('Password changed for box %s'), $boxname);
 	}
 	$template->param( MESSAGE => $message );
 }

Modified: branches/vhffs_4.1/vhffs-panel/mail/change_forward.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/mail/change_forward.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/mail/change_forward.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -64,7 +64,7 @@
 my $forward = $cgi->param("FORWARD");
 my $template;
 my $message;
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
+my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain );
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
@@ -73,17 +73,9 @@
 if( ! defined $mail )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = sprintf( gettext("Cannot instanciate object %s"), $domain );
+    $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 	$template->param( MESSAGE => $message );
 }
-elsif( $mail->fetch < 0 )
-{
-
-	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = gettext( "Cannot get informations on this object");
-	$template->param( MESSAGE => $message );
-
-}
 elsif( ( ! defined $boxname ) || ( ! defined $forward ) )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
@@ -109,18 +101,11 @@
 
 	if( ( $retour = $mail->change_forward( $boxname , $forward ) ) < 0 )
 	{
-		$message = gettext( "Can't modify forwarding" ) . "$retour , $boxname , $domain , $forward";
+		$message = sprintf( gettext( 'Unable to modify forward %s (%d)' ), $boxname , $retour );
 	}
 	else
 	{
-		if( $mail->commit < 0 )
-		{
-			$message = gettext( "Unable to reccord changes on this domain" );
-		}
-		else
-		{
-			$message = gettext( "Forwarding successfully added" );
-		}
+		$message = gettext( 'Forward successfully added' );
 	}
 	$template->param( MESSAGE => $message );
 }

Modified: branches/vhffs_4.1/vhffs-panel/mail/delete.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/mail/delete.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/mail/delete.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -63,7 +63,7 @@
 my $sure = $cgi->param("DELETE");
 my $template;
 my $message;
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
+my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain );
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
@@ -73,9 +73,9 @@
 {
 	$message = gettext( "CGI ERROR");
 }
-elsif( $mail->fetch < 0 )
+elsif( !defined $mail )
 {
-	$message = gettext( "Cannot get informations on this object");
+    $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 }
 elsif( $mail->get_status != Vhffs::Constants::ACTIVATED )
 {

Modified: branches/vhffs_4.1/vhffs-panel/mail/delete_box.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/mail/delete_box.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/mail/delete_box.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -63,24 +63,16 @@
 my $boxname = $cgi->param("LOCALPART");
 my $template;
 my $message;
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
+my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain );
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
 if( ! defined $mail )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = sprintf( gettext("Cannot instanciate object %s"), $domain );
+    $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 	$template->param( MESSAGE => $message );
 }
-elsif( $mail->fetch < 0 )
-{
-
-	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = gettext( "Cannot get informations on this object");
-	$template->param( MESSAGE => $message );
-
-}
 elsif( ! defined $boxname )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );

Modified: branches/vhffs_4.1/vhffs-panel/mail/delete_forward.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/mail/delete_forward.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/mail/delete_forward.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -63,7 +63,7 @@
 my $boxname = $cgi->param("LOCALPART");
 my $template;
 my $message;
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
+my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain );
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
@@ -71,14 +71,9 @@
 
 if( ! defined $mail )
 {
-	$message = sprintf( gettext("Cannot instanciate object %s"), $domain );
+    $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 	$template->param( MESSAGE => $message );
 }
-elsif( $mail->fetch < 0 )
-{
-	$message = gettext( "Cannot get informations on this object");
-	$template->param( MESSAGE => $message );
-}
 elsif( ! defined $boxname )
 {
 	$message = gettext( "CGI ERROR");
@@ -98,11 +93,11 @@
 {
 	if( $mail->delforward( $boxname ) < 0 )
 	{
-		$message = "Can't delete forward";
+		$message = sprintf(gettext('Unable to delete forward %s'), $boxname);
 	}
 	else
 	{
-		$message = "Forward successfully deleted";
+		$message = gettext("Forward successfully deleted");
 	}
 	$template->param( MESSAGE => $message );
 }

Modified: branches/vhffs_4.1/vhffs-panel/mail/password_box.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/mail/password_box.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/mail/password_box.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -64,7 +64,7 @@
 my $password = $cgi->param("PASSWORD");
 my $template;
 my $message;
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
+my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain );
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
@@ -73,17 +73,9 @@
 if( ! defined $mail )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = sprintf( gettext("Cannot instanciate object %s"), $domain );
+    $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 	$template->param( MESSAGE => $message );
 }
-elsif( $mail->fetch < 0 )
-{
-
-	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = gettext( "Cannot get informations on this object");
-	$template->param( MESSAGE => $message );
-
-}
 elsif( ( ! defined $password ) || ( ! defined $boxname ) )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
@@ -113,14 +105,7 @@
 	}
 	else
 	{
-		if( $mail->commit < 0 )
-		{
-			$message = gettext( "Unable to reccord changes on this domain" );
-		}
-		else
-		{
-			$message = gettext( "Password successfully changed" );
-		}
+		$message = gettext( "Password successfully changed" );
 	}
 	$template->param( MESSAGE => $message );
 }

Modified: branches/vhffs_4.1/vhffs-panel/mail/prefs.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/mail/prefs.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/mail/prefs.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -68,13 +68,13 @@
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
+my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain );
 
-if( $mail->fetch < 0 )
+if( !defined $mail )
 {
 
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	my $message = gettext( "Cannot get informations on this object");
+    $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 	$template->param( MESSAGE => $message );
 
 }

Modified: branches/vhffs_4.1/vhffs-panel/mail/spambox.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/mail/spambox.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/mail/spambox.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -64,7 +64,7 @@
 my $password = $cgi->param("PASSWORD");
 my $template;
 my $message;
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
+my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain );
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
@@ -73,17 +73,9 @@
 if( ! defined $mail )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = sprintf( gettext("Cannot instanciate object %s"), $domain );
+    $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 	$template->param( MESSAGE => $message );
 }
-elsif( $mail->fetch < 0 )
-{
-
-	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = gettext( "Cannot get informations on this object");
-	$template->param( MESSAGE => $message );
-
-}
 elsif( ! defined $boxname ) 
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
@@ -115,18 +107,11 @@
 
 	if( ( $retour = $mail->change_spam_status( $boxname ) ) < 0 )
 	{
-		$message = gettext( "Error when applying changes" );
+		$message = sprintf(gettext( 'Unable to change spam status for %s' ), $boxname);
 	}
 	else
 	{
-		if( $mail->commit < 0 )
-		{
-			$message = gettext( "Unable to reccord changes on this domain" );
-		}
-		else
-		{
-			$message = sprintf(gettext( "Spam status updated for box %s" ) , $boxname );
-		}
+		$message = sprintf(gettext( 'Spam status updated for box %s' ) , $boxname );
 	}
 	$template->param( MESSAGE => $message );
 }

Modified: branches/vhffs_4.1/vhffs-panel/mail/spamvirus.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/mail/spamvirus.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/mail/spamvirus.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -64,7 +64,7 @@
 my $password = $cgi->param("PASSWORD");
 my $template;
 my $message;
-my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group );
+my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain );
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
@@ -73,17 +73,9 @@
 if( ! defined $mail )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = sprintf( gettext("Cannot instanciate object %s"), $domain );
+    $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain );
 	$template->param( MESSAGE => $message );
 }
-elsif( $mail->fetch < 0 )
-{
-
-	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = gettext( "Cannot get informations on this object");
-	$template->param( MESSAGE => $message );
-
-}
 elsif( ! defined $boxname ) 
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
@@ -115,18 +107,11 @@
 
 	if( ( $retour = $mail->change_virus_status( $boxname ) ) < 0 )
 	{
-		$message = gettext( "Error when applying changes" );
+		$message = sprintf(gettext( 'Unable to change virus protection status for %s' ), $boxname);
 	}
 	else
 	{
-		if( $mail->commit < 0 )
-		{
-			$message = gettext( "Unable to reccord changes on this domain" );
-		}
-		else
-		{
-			$message = sprintf(gettext( "Virus status updated for box %s" ) , $boxname );
-		}
+		$message = sprintf(gettext( "Virus status updated for box %s" ) , $boxname );
 	}
 	$template->param( MESSAGE => $message );
 }

Modified: branches/vhffs_4.1/vhffs-panel/mail/submit.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/mail/submit.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-panel/mail/submit.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -77,10 +77,8 @@
 {
 	$message = gettext("Invalid mail domain");
 }
-elsif( defined ( $mail = Vhffs::Panel::Mail::create_mail( $vhffs , $domain , $user , $group ) ))
+elsif( defined ( $mail = Vhffs::Panel::Mail::create_mail( $vhffs , $domain , $description, $user , $group ) ))
 {
-	$mail->set_description( $description );
-	$mail->commit;
 	$message = gettext("Mail area successfully created !");
 }
 else

Modified: branches/vhffs_4.1/vhffs-robots/src/create_mail.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/create_mail.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-robots/src/create_mail.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -32,6 +32,8 @@
 #This robot create mail domain
 #It actives it
 
+# FIXME : This robot is unnecessary, we just have to activate mailbox on creation
+
 use lib '/usr/share/vhffs/api';
 use Vhffs::Services::Mail;
 use Vhffs::Robots;

Modified: branches/vhffs_4.1/vhffs-robots/src/refused_mail.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/refused_mail.pl	2007-02-17 12:42:15 UTC (rev 475)
+++ branches/vhffs_4.1/vhffs-robots/src/refused_mail.pl	2007-02-17 13:59:13 UTC (rev 476)
@@ -60,7 +60,7 @@
 
 foreach $object ( @{$objects} )
 {
-	if( ( defined $object ) && ( $object->fetch > 0 ) )
+	if( defined $object )
 	{
 		$user = $object->get_user;
 		$lang = Vhffs::Panel::User::get_lang( $user );


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