[vhffs-dev] [2022] Reworked Vhffs::Services::MailUser, Vhffs::Services::MailGroup, Vhffs::Services::Newsletter

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


Revision: 2022
Author:   gradator
Date:     2012-02-19 02:45:33 +0100 (Sun, 19 Feb 2012)
Log Message:
-----------
Reworked Vhffs::Services::MailUser, Vhffs::Services::MailGroup, Vhffs::Services::Newsletter

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Group.pm
    trunk/vhffs-api/src/Vhffs/Panel/Auth.pm
    trunk/vhffs-api/src/Vhffs/Panel/Group.pm
    trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm
    trunk/vhffs-api/src/Vhffs/Panel/User.pm
    trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm
    trunk/vhffs-api/src/Vhffs/Services/MailGroup.pm
    trunk/vhffs-api/src/Vhffs/Services/MailUser.pm
    trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm
    trunk/vhffs-api/src/Vhffs/User.pm
    trunk/vhffs-api/src/examples/mailuser.pl
    trunk/vhffs-api/src/examples/mailuser_add_box.pl

Modified: trunk/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/Vhffs/Group.pm	2012-02-19 01:45:33 UTC (rev 2022)
@@ -426,8 +426,8 @@
 sub delete {
 	my $self = shift;
 
-	use Vhffs::Services::MailGroup;
-	my $mg = init Vhffs::Services::MailGroup( $self->{'main'} , $self );
+	require Vhffs::Services::MailGroup;
+	my $mg = new Vhffs::Services::MailGroup( $self->{'main'} , $self );
 	if( defined $mg ) {
 		$mg->delbox;
 		$mg->delforward;

Modified: trunk/vhffs-api/src/Vhffs/Panel/Auth.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Auth.pm	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/Vhffs/Panel/Auth.pm	2012-02-19 01:45:33 UTC (rev 2022)
@@ -166,7 +166,7 @@
 		$user->set_password( $password );
 		$user->commit;
 
-		my $mu = init Vhffs::Services::MailUser( $vhffs, $user );
+		my $mu = new Vhffs::Services::MailUser( $vhffs, $user );
 		$mu->changepassword( $password ) if defined $mu and $mu->exists_box;
   
 		# Send a mail with plain text password inside

Modified: trunk/vhffs-api/src/Vhffs/Panel/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Group.pm	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/Vhffs/Panel/Group.pm	2012-02-19 01:45:33 UTC (rev 2022)
@@ -526,7 +526,7 @@
 			unless( defined $forward  &&  ( $forward eq ''  ||  Vhffs::Functions::valid_mail( $forward ) )  ) {
 				$panel->add_error( gettext('The email you entered fails syntax check') );
 			} else {
-				my $mg = init Vhffs::Services::MailGroup( $vhffs , $group );
+				my $mg = new Vhffs::Services::MailGroup( $vhffs , $group );
 				if( defined $mg ) {
 					if( $forward eq '' )  {
 						$mg->delforward( $forward );
@@ -558,7 +558,7 @@
 	$panel->set_title( gettext('Project Preferences') );
 
 	$vars->{group} = $group;
-	$vars->{mailgroup} = init Vhffs::Services::MailGroup( $vhffs , $group );
+	$vars->{mailgroup} = new Vhffs::Services::MailGroup( $vhffs , $group );
 	$vars->{use_avatars} = $panel->use_groups_avatars;
 	$vars->{group_users} = Vhffs::Panel::Group::getall_users( $vhffs , $group->get_gid );
 

Modified: trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm	2012-02-19 01:45:33 UTC (rev 2022)
@@ -126,7 +126,7 @@
 					# Newsletter
 					if( $vhffs->get_config->get_service_availability('newsletter') ) {
 						require Vhffs::Services::Newsletter;
-						my $newsletter = init Vhffs::Services::Newsletter( $vhffs , $user );
+						my $newsletter = new Vhffs::Services::Newsletter( $vhffs , $user );
 						if( defined $newsletter and ( 
 						  ( $newsletter->get_collectmode == Vhffs::Services::Newsletter::ACTIVE_OPTIN && $newslettercheckbox )
 						  or ( $newsletter->get_collectmode == Vhffs::Services::Newsletter::PASSIVE_OPTIN && $newslettercheckbox )

Modified: trunk/vhffs-api/src/Vhffs/Panel/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/User.pm	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/Vhffs/Panel/User.pm	2012-02-19 01:45:33 UTC (rev 2022)
@@ -440,7 +440,7 @@
 						$userp->set_password( $pass1 );
 						$panel->add_info( gettext('Password changed') );
 
-						my $mu = init Vhffs::Services::MailUser( $vhffs , $userp );
+						my $mu = new Vhffs::Services::MailUser( $vhffs , $userp );
 						$mu->changepassword( $pass1 ) if defined $mu and $mu->exists_box;
 					}
 
@@ -448,7 +448,7 @@
 					if( $prevmail ne $mail ) {
 						$mail_change = 1;
 
-						my $newsletter = init Vhffs::Services::Newsletter( $vhffs , $userp );
+						my $newsletter = new Vhffs::Services::Newsletter( $vhffs , $userp );
 						$newsletter->del if defined $newsletter;
 
 						$userp->set_mail( $mail );
@@ -464,7 +464,7 @@
 					}
 
 					# -- Mail User
-					my $mu = init Vhffs::Services::MailUser( $vhffs , $userp );
+					my $mu = new Vhffs::Services::MailUser( $vhffs , $userp );
 					if( defined $mu )  {
 					
 						my $mail_activate = $cgi->param( 'mail_activate' );
@@ -562,7 +562,7 @@
 					}
 
 					# -- Newsletter
-					my $newsletter = init Vhffs::Services::Newsletter( $vhffs , $userp );
+					my $newsletter = new Vhffs::Services::Newsletter( $vhffs , $userp );
 					if( defined $newsletter )  {
 						if( $newslettercheckbox and not $newsletter->exists ) {
 							$newsletter->add;
@@ -630,10 +630,10 @@
 	        $vars->{shells} = [ Vhffs::Panel::User::default_shell( $vhffs ) ];
 	}
 
-	my $newsletter = init Vhffs::Services::Newsletter( $vhffs , $userp );
+	my $newsletter = new Vhffs::Services::Newsletter( $vhffs , $userp );
 	$vars->{newsletter} = { active => 1, subscribed => $newsletter->exists } if defined $newsletter and $newsletter->get_collectmode != Vhffs::Services::Newsletter::PERMANENT;
 
-	my $mu = init Vhffs::Services::MailUser( $vhffs , $userp );
+	my $mu = new Vhffs::Services::MailUser( $vhffs , $userp );
 	if(defined $mu) {
 		my $mu_config = $vhffs->get_config->get_service( 'mailuser' );
 		my $mail_config = $vhffs->get_config->get_service('mail');

Modified: trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm	2012-02-19 01:45:33 UTC (rev 2022)
@@ -100,7 +100,7 @@
 
 	print $rcfileout "[web]\n";
 	print $rcfileout "description =\n  " . $description . "\n";
-	my $mg = init Vhffs::Services::MailGroup( $mercurial->get_main , $mercurial->get_group );
+	my $mg = new Vhffs::Services::MailGroup( $mercurial->get_main , $mercurial->get_group );
 	if( defined $mg )
 	{
 		print $rcfileout "contact = " . $mercurial->get_group->get_groupname . '@' . $mg->{config}->{domain} . "\n";

Modified: trunk/vhffs-api/src/Vhffs/Services/MailGroup.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/MailGroup.pm	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/Vhffs/Services/MailGroup.pm	2012-02-19 01:45:33 UTC (rev 2022)
@@ -2,31 +2,31 @@
 # Copyright (c) vhffs project and its contributors
 # All rights reserved.
 #
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
 # are met:
 #
-# 1. Redistributions of source code must retain the above copyright 
+# 1. Redistributions of source code must retain the above copyright
 #   notice, this list of conditions and the following disclaimer.
 #2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
 #   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
+#3. Neither the name of vhffs nor the names of its contributors
+#   may be used to endorse or promote products derived from this
 #   software without specific prior written permission.
 #
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
 
@@ -49,13 +49,12 @@
 
 
 # Create a new instance of the current class
-sub init
-{
+sub new {
 	my $class = shift;
 	my $vhffs = shift;
 	my $group = shift;
 
-	return undef unless ( defined $vhffs  &&  defined  $group  &&  $vhffs->get_config->get_service_availability('mailgroup') );
+	return undef unless defined $vhffs and defined $group and $vhffs->get_config->get_service_availability('mailgroup');
 	my $config = $vhffs->get_config->get_service('mailgroup');
 
 	# Fetches the mail domain defined in config
@@ -69,96 +68,83 @@
 	$this->{localpart} = $group->get_groupname;
 	$this->{domain} = $config->{domain};
 	$this->{mail_service} = $mail_service;
-	bless( $this , $class );
+	bless( $this, $class );
 	return $this;
 }
 
-sub exists
-{
+sub exists {
 	my $self = shift;
 	return $self->{mail_service}->exists( $self->{localpart} );
 }
 
-sub exists_forward
-{
+sub exists_forward {
 	my $self = shift;
 	return $self->{mail_service}->exists_forward( $self->{localpart} );
 }
 
-sub exists_box
-{
+sub exists_box {
 	my $self = shift;
 	return $self->{mail_service}->exists_box( $self->{localpart} );
 }
 
-sub use_nospam
-{
+sub use_nospam {
 	my $self = shift;
 	return $self->{mail_service}->use_nospam( $self->{localpart} );
 }
 
-sub use_novirus
-{
+sub use_novirus {
 	my $self = shift;
 	return $self->{mail_service}->use_novirus( $self->{localpart} );
 }
 
-sub change_spam_status
-{
+sub change_spam_status {
 	my $self = shift;
 	$self->{mail_service}->change_spam_status( $self->{localpart} );
 	return 1;
 }
 
-sub change_virus_status
-{
+sub change_virus_status {
 	my $self = shift;
 	$self->{mail_service}->change_virus_status( $self->{localpart} );
 	return 1;
 }
 
-sub addforward
-{
+sub addforward {
 	my $self = shift;
 	my $remote = shift;
 	
-	$self->{mail_service}->delforward( $self->{localpart} ) if( $self->exists_forward == 1 );
-	$self->{mail_service}->set_box_status( $self->{localpart} , Vhffs::Constants::TO_DELETE ) if( $self->exists_box == 1 );
-	return -1 if ( $self->{mail_service}->addforward( $self->{localpart} , $remote ) < 0);
+	$self->{mail_service}->delforward( $self->{localpart} ) if $self->exists_forward;
+	$self->{mail_service}->set_box_status( $self->{localpart}, Vhffs::Constants::TO_DELETE ) if $self->exists_box;
+	return $self->{mail_service}->addforward( $self->{localpart}, $remote );
 }
 
-sub getforward
-{
+sub getforward {
 	my $self = shift;
 	return undef unless $self->{mail_service}->{'forward'}->{$self->{localpart}};
 	return $self->{mail_service}->{'forward'}->{$self->{localpart}}->{'remote_name'};
 }
 
-sub delforward
-{
+sub delforward {
 	my $self = shift;
 	$self->{mail_service}->delforward( $self->{localpart} );
 }
 
-sub delbox
-{
+sub delbox {
 	my $self = shift;
-	$self->{mail_service}->set_box_status( $self->{localpart} , Vhffs::Constants::TO_DELETE );
+	$self->{mail_service}->set_box_status( $self->{localpart}, Vhffs::Constants::TO_DELETE );
 }
 
-sub addbox
-{
+sub addbox {
 	my $self = shift;
 	my $password = shift;
 
-	$self->{mail_service}->delforward( $self->{localpart} ) if( $self->exists_forward == 1 );
-	return -1 if( $self->{mail_service}->addbox( $self->{localpart} , $password ) < 0);
+	$self->{mail_service}->delforward( $self->{localpart} ) if $self->exists_forward;
+	return $self->{mail_service}->addbox( $self->{localpart}, $password );
 }
 
-sub changepassword
-{
+sub changepassword {
 	my ($self, $newpass) = @_;
-	return -1 if( $self->{mail_service}->change_box_password( $self->{localpart}, $newpass ) < 0 );
+	return $self->{mail_service}->change_box_password( $self->{localpart}, $newpass );
 }
 
 1;

Modified: trunk/vhffs-api/src/Vhffs/Services/MailUser.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/MailUser.pm	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/Vhffs/Services/MailUser.pm	2012-02-19 01:45:33 UTC (rev 2022)
@@ -49,20 +49,19 @@
 
 
 # Create a new instance of the current class
-sub init
-{
+sub new {
 	my $class = shift;
 	my $vhffs = shift;
 	my $user = shift;
 
-	return undef unless ( defined $vhffs  &&  defined  $user  &&  $vhffs->get_config->get_service_availability('mailuser') );
+	return undef unless defined $vhffs and defined $user and $vhffs->get_config->get_service_availability('mailuser');
 	my $config = $vhffs->get_config->get_service('mailuser');
 
 	# Fetches the mail domain defined in config
 	my $mail_service = Vhffs::Services::Mail::get_by_mxdomain( $vhffs, $config->{domain} );
 	return undef unless defined $mail_service;
 
-	return undef unless( not $config->{groupneeded}  ||  $user->have_activegroups > 0  ||  $mail_service->exists( $user->get_username ) );
+	return undef unless( not $config->{groupneeded} or $user->have_activegroups > 0 or $mail_service->exists($user->get_username) );
 
 	my $this = {};
 	$this->{main} = $vhffs;
@@ -71,103 +70,89 @@
 	$this->{localpart} = $user->get_username;
 	$this->{domain} = $config->{domain};
 	$this->{mail_service} = $mail_service;
-	bless( $this , $class );
+	bless( $this, $class );
 	return $this;
 }
 
-sub exists
-{
+sub exists {
 	my $self = shift;
 	return $self->{mail_service}->exists( $self->{localpart} );
 }
 
-sub exists_forward
-{
+sub exists_forward {
 	my $self = shift;
 	return $self->{mail_service}->exists_forward( $self->{localpart} );
 }
 
-sub exists_box
-{
+sub exists_box {
 	my $self = shift;
 	return $self->{mail_service}->exists_box( $self->{localpart} );
 }
 
-sub use_nospam
-{
+sub use_nospam {
 	my $self = shift;
 	return $self->{mail_service}->use_nospam( $self->{localpart} );
 }
 
-sub use_novirus
-{
+sub use_novirus {
 	my $self = shift;
 	return $self->{mail_service}->use_novirus( $self->{localpart} );
 }
 
-sub change_spam_status
-{
+sub change_spam_status {
 	my $self = shift;
 	$self->{mail_service}->change_spam_status( $self->{localpart} );
 	return 1;
 }
 
-sub change_virus_status
-{
+sub change_virus_status {
 	my $self = shift;
 	$self->{mail_service}->change_virus_status( $self->{localpart} );
 	return 1;
 }
 
-sub get_box_status
-{
+sub get_box_status {
 	my $self = shift;
 	return undef unless defined $self->{mail_service}->{'boxes'}->{$self->{localpart}};
 	return $self->{mail_service}->{'boxes'}->{$self->{localpart}}{'state'};
 }
 
-sub addforward
-{
+sub addforward {
 	my $self = shift;
 	my $remote = shift;
 	
-	$self->{mail_service}->delforward( $self->{localpart} ) if( $self->exists_forward == 1 );
-	$self->{mail_service}->set_box_status( $self->{localpart} , Vhffs::Constants::TO_DELETE ) if( $self->exists_box == 1 );
-	return -1 if ( $self->{mail_service}->addforward( $self->{localpart} , $remote ) < 0);
+	$self->{mail_service}->delforward( $self->{localpart} ) if $self->exists_forward;
+	$self->{mail_service}->set_box_status( $self->{localpart}, Vhffs::Constants::TO_DELETE ) if $self->exists_box;
+	return $self->{mail_service}->addforward( $self->{localpart}, $remote );
 }
 
-sub getforward
-{
+sub getforward {
 	my $self = shift;
 	return undef unless $self->{mail_service}->{'forward'}->{$self->{localpart}};
 	return $self->{mail_service}->{'forward'}->{$self->{localpart}}->{'remote_name'};
 }
 
-sub delforward
-{
+sub delforward {
 	my $self = shift;
 	$self->{mail_service}->delforward( $self->{localpart} );
 }
 
-sub delbox
-{
+sub delbox {
 	my $self = shift;
-	$self->{mail_service}->set_box_status( $self->{localpart} , Vhffs::Constants::TO_DELETE );
+	$self->{mail_service}->set_box_status( $self->{localpart}, Vhffs::Constants::TO_DELETE );
 }
 
-sub addbox
-{
+sub addbox {
 	my $self = shift;
 	my $password = shift;
 
-	$self->{mail_service}->delforward( $self->{localpart} ) if( $self->exists_forward == 1 );
-	return -1 if( $self->{mail_service}->addbox( $self->{localpart} , $password ) < 0);
+	$self->{mail_service}->delforward( $self->{localpart} ) if $self->exists_forward;
+	return $self->{mail_service}->addbox( $self->{localpart}, $password );
 }
 
-sub changepassword
-{
+sub changepassword {
 	my ($self, $newpass) = @_;
-	return -1 if( $self->{mail_service}->change_box_password( $self->{localpart}, $newpass ) < 0 );
+	return $self->{mail_service}->change_box_password( $self->{localpart}, $newpass );
 }
 
 1;

Modified: trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm	2012-02-19 01:45:33 UTC (rev 2022)
@@ -42,8 +42,7 @@
 
 use Vhffs::Services::MailingList;
 
-use constant
-{
+use constant {
 	ACTIVE_OPTIN => 1,
     	PASSIVE_OPTIN => 2,
 	ACTIVE_OPTOUT => 3,
@@ -51,21 +50,19 @@
 	PERMANENT => 5,
 };
 
-
 # Create a new instance of the current class
-sub init
-{
+sub new {
 	my $class = shift;
 	my $vhffs = shift;
 	my $user = shift;
 
-	return undef unless ( defined $vhffs  &&  defined  $user  &&  $vhffs->get_config->get_service_availability('newsletter') );
+	return undef unless defined $vhffs and defined $user and $vhffs->get_config->get_service_availability('newsletter');
 	my $config = $vhffs->get_config->get_service('newsletter');
 
 	# Fetches the mail domain defined in config
 	my $mailinglist_service;
 	if( defined $config->{'mailinglist'} )  {
-		my ( $localpart , $domain ) =  ( $config->{'mailinglist'} =~ /(.+)\@(.+)/ );
+		my ( $localpart, $domain ) = ( $config->{'mailinglist'} =~ /(.+)\@(.+)/ );
 		$mailinglist_service = Vhffs::Services::MailingList::get_by_mladdress( $vhffs, $localpart, $domain );
 	}
 	return undef unless defined $mailinglist_service;
@@ -82,30 +79,26 @@
 		$this->{collectmode} = PERMANENT if $config->{'collectmode'} eq 'permanent';
 	}
 	$this->{mailinglist_service} = $mailinglist_service;
-	bless( $this , $class );
+	bless( $this, $class );
 	return $this;
 }
 
-sub exists
-{
+sub exists {
 	my $self = shift;
 	return defined $self->{'mailinglist_service'}->get_members->{ $self->{'user'}->get_mail };
 }
 
-sub add
-{
+sub add {
 	my $self = shift;
 	return $self->{'mailinglist_service'}->add_sub( $self->{'user'}->get_mail , Vhffs::Constants::ML_RIGHT_SUB );
 }
 
-sub del
-{
+sub del {
 	my $self = shift;
 	return $self->{'mailinglist_service'}->del_sub( $self->{'user'}->get_mail );
 }
 
-sub get_collectmode
-{
+sub get_collectmode {
 	my $self = shift;
 	return $self->{collectmode};
 }

Modified: trunk/vhffs-api/src/Vhffs/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/User.pm	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/Vhffs/User.pm	2012-02-19 01:45:33 UTC (rev 2022)
@@ -391,7 +391,7 @@
 
 	# delete mail user if mail_user is enabled
 	use Vhffs::Services::MailUser;
-	my $mu = init Vhffs::Services::MailUser( $self->{'main'} , $self );
+	my $mu = new Vhffs::Services::MailUser( $self->{'main'} , $self );
 	if( defined $mu ) {
 		$mu->delbox;
 		$mu->delforward;
@@ -399,7 +399,7 @@
 
 	# remove subscription from newsletter
 	use Vhffs::Services::Newsletter;
-	my $newsletter = init Vhffs::Services::Newsletter( $self->{'main'} , $self );
+	my $newsletter = new Vhffs::Services::Newsletter( $self->{'main'} , $self );
 	$newsletter->del if defined $newsletter;
 
 	# User references corresponding object with an ON DELETE cascade foreign key

Modified: trunk/vhffs-api/src/examples/mailuser.pl
===================================================================
--- trunk/vhffs-api/src/examples/mailuser.pl	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/examples/mailuser.pl	2012-02-19 01:45:33 UTC (rev 2022)
@@ -22,7 +22,7 @@
 my $user = Vhffs::User::get_by_username($princ, $username);
 die("User not found\n") unless(defined $user);
 
-my $mu = init Vhffs::Services::MailUser( $princ , $user );
+my $mu = new Vhffs::Services::MailUser( $princ , $user );
 die("Configuration error\n") if(!ref($mu));
 
 if( $mu->exists_forward == 1 ) {

Modified: trunk/vhffs-api/src/examples/mailuser_add_box.pl
===================================================================
--- trunk/vhffs-api/src/examples/mailuser_add_box.pl	2012-02-18 23:59:40 UTC (rev 2021)
+++ trunk/vhffs-api/src/examples/mailuser_add_box.pl	2012-02-19 01:45:33 UTC (rev 2022)
@@ -22,7 +22,7 @@
 my $user = Vhffs::User::get_by_username($princ, $username);
 die("User not found\n") unless(defined $user);
 
-my $mu = init Vhffs::Services::MailUser( $princ , $user );
+my $mu = new Vhffs::Services::MailUser( $princ , $user );
 
 die("Unable to create box $username\@".$mu->{domain}."\n") unless($mu->addbox( $password ) > 0);
 print "Box $username\@".$mu->{domain}." created\n";


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