[vhffs-dev] [1000] Fixed bug #230, mail group is deleted when the group is deleted ( improved deletion of mail user when a user is deleted)

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


Revision: 1000
Author:   gradator
Date:     2007-10-16 21:46:24 +0000 (Tue, 16 Oct 2007)

Log Message:
-----------
Fixed bug #230, mail group is deleted when the group is deleted (improved deletion of mail user when a user is deleted)

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Group.pm
    trunk/vhffs-api/src/Vhffs/User.pm


Modified: trunk/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm	2007-10-16 21:38:21 UTC (rev 999)
+++ trunk/vhffs-api/src/Vhffs/Group.pm	2007-10-16 21:46:24 UTC (rev 1000)
@@ -286,6 +286,14 @@
 
     $self = shift;
 
+	use Vhffs::Services::MailGroup;
+	my $mg = init Vhffs::Services::MailGroup( $self->{'main'} , $self );
+	if( defined $mg )
+	{
+		$mg->delbox;
+		$mg->delforward;
+	}
+
     $request = $self->{'db'}->prepare('DELETE FROM vhffs_groups WHERE gid=?');
     $request->execute($self->{'gid'}) or return -1;
     

Modified: trunk/vhffs-api/src/Vhffs/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/User.pm	2007-10-16 21:38:21 UTC (rev 999)
+++ trunk/vhffs-api/src/Vhffs/User.pm	2007-10-16 21:46:24 UTC (rev 1000)
@@ -289,17 +289,12 @@
     return -2 if ( $self->{'group'}->delete < 0 );
 
 	# delete mail user if mail_user is enabled
-	if( $self->{'main'}->get_config->get_service_availability('mailuser') == 1 )
+	use Vhffs::Services::MailUser;
+	my $mu = init Vhffs::Services::MailUser( $self->{'main'} , $self );
+	if( defined $mu )
 	{
-		use Vhffs::Services::Mail;
-		use Vhffs::Services::MailUser;
-		my $mu = init Vhffs::Services::MailUser( $self->{'main'} , $self );
-
-		if( defined $mu )
-		{
-			$mu->delbox;
-			$mu->delforward;
-		}
+		$mu->delbox;
+		$mu->delforward;
 	}
 
     # User references corresponding object with an ON DELETE cascade foreign key


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