[vhffs-dev] [2162] get_config method added to Services which retourne the configuration part related to the current object , changed all calls to get_config using this new design

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


Revision: 2162
Author:   gradator
Date:     2012-04-29 01:25:19 +0200 (Sun, 29 Apr 2012)
Log Message:
-----------
get_config method added to Services which retourne the configuration part related to the current object, changed all calls to get_config using this new design

Modified Paths:
--------------
    trunk/vhffs-api/examples/Makefile.am
    trunk/vhffs-api/src/Vhffs/Group.pm
    trunk/vhffs-api/src/Vhffs/Object.pm
    trunk/vhffs-api/src/Vhffs/Panel/Auth.pm
    trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm
    trunk/vhffs-api/src/Vhffs/Panel/Git.pm
    trunk/vhffs-api/src/Vhffs/Panel/Home.pm
    trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm
    trunk/vhffs-api/src/Vhffs/Panel/Public.pm
    trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm
    trunk/vhffs-api/src/Vhffs/Panel/Svn.pm
    trunk/vhffs-api/src/Vhffs/Panel/User.pm
    trunk/vhffs-api/src/Vhffs/Panel.pm
    trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm
    trunk/vhffs-api/src/Vhffs/Robots/Git.pm
    trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm
    trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm
    trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm
    trunk/vhffs-api/src/Vhffs/Robots/Svn.pm
    trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm
    trunk/vhffs-api/src/Vhffs/Services/Cron.pm
    trunk/vhffs-api/src/Vhffs/Services/Cvs.pm
    trunk/vhffs-api/src/Vhffs/Services/DNS.pm
    trunk/vhffs-api/src/Vhffs/Services/Git.pm
    trunk/vhffs-api/src/Vhffs/Services/Mail.pm
    trunk/vhffs-api/src/Vhffs/Services/MailingList.pm
    trunk/vhffs-api/src/Vhffs/Services/Mercurial.pm
    trunk/vhffs-api/src/Vhffs/Services/Mysql.pm
    trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm
    trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm
    trunk/vhffs-api/src/Vhffs/Services/Repository.pm
    trunk/vhffs-api/src/Vhffs/Services/Svn.pm
    trunk/vhffs-api/src/Vhffs/Services/Web.pm
    trunk/vhffs-api/src/Vhffs/User.pm
    trunk/vhffs-irc/modobot.pl
    trunk/vhffs-listengine/src/listengine.pl

Removed Paths:
-------------
    trunk/vhffs-api/examples/list_themes.pl

Modified: trunk/vhffs-api/examples/Makefile.am
===================================================================
--- trunk/vhffs-api/examples/Makefile.am	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/examples/Makefile.am	2012-04-28 23:25:19 UTC (rev 2162)
@@ -23,7 +23,6 @@
 	generate_password.pl \
 	get_list.pl \
 	join_group.pl \
-	list_themes.pl \
 	mailuser_add_box.pl \
 	mailuser.pl \
 	modify_acl.pl \

Deleted: trunk/vhffs-api/examples/list_themes.pl
===================================================================
--- trunk/vhffs-api/examples/list_themes.pl	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/examples/list_themes.pl	2012-04-28 23:25:19 UTC (rev 2162)
@@ -1,17 +0,0 @@
-#!%PERL%
-
-use strict;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Panel;
-use Vhffs;
-use Data::Dumper;
-
-my $vhffs = new Vhffs;
-
-my @themes = Vhffs::Panel::list_themes( $vhffs );
-
-foreach( @themes )
-{
-	print "$_\n";
-}

Modified: trunk/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Group.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -508,6 +508,16 @@
 	return $self->{groupname};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_groups;
+}
+
 =pod
 
 =head2 get_quota
@@ -553,7 +563,7 @@
 =cut
 sub get_dir {
 	my $self = shift;
-	return $self->get_config->get_datadir.'/groups/'.substr($self->get_groupname, 0, 1).'/'.substr($self->get_groupname, 1, 1).'/'.$self->get_groupname;
+	return $self->get_vhffs->get_config->get_datadir.'/groups/'.substr($self->get_groupname, 0, 1).'/'.substr($self->get_groupname, 1, 1).'/'.$self->get_groupname;
 }
 
 =pod

Modified: trunk/vhffs-api/src/Vhffs/Object.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Object.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Object.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -310,12 +310,12 @@
 
 =head1 get_config
 
-Returns a C<Vhffs::Conf> object.
+Returns the configuration for this object. Should be redefined in every subclasses
+(for example, Web returns the web configuration).
 
 =cut
 sub get_config {
-	my $self = shift;
-	return $self->get_vhffs->get_config;
+	return;
 }
 
 =pod

Modified: trunk/vhffs-api/src/Vhffs/Panel/Auth.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Auth.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Panel/Auth.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -52,7 +52,7 @@
 	$vars->{subscription_allowed} = $vhffs->get_config->get_allow_subscribe;
 	$vars->{website} = $website;
 	$vars->{hostname} = $hostname;
-	if( $vhffs->get_config->get_panel->{'stats_on_home'} ) {
+	if( $panel->get_config->{'stats_on_home'} ) {
 		my $stats = $vhffs->get_stats;
 		$vars->{stats} = {
 			users => $stats->get_user_total,

Modified: trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -194,7 +194,7 @@
 	$panel->set_title( gettext("Modify Bazaar repository") );
 	my $vars = {};
 	$vars->{repository} = $bazaar;
-	$vars->{notify_from} = 'Please finish bazaar implementation'; # $vhffs->get_config->get_service('bazaar')->{notify_from};
+	$vars->{notify_from} = 'Please finish bazaar implementation'; # $bazaar->get_config->{notify_from};
 	$vars->{type} = 'bazaar';
 	$panel->render( 'scm/prefs.tt', $vars );
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Git.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Panel/Git.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -196,7 +196,7 @@
 	$panel->set_title( gettext('Modify Git repository') );
 	my $vars = {};
 	$vars->{repository} = $git;
-	$vars->{notify_from} = $vhffs->get_config->get_service('git')->{notify_from};
+	$vars->{notify_from} = $git->get_config->{notify_from};
 	$vars->{type} = 'git';
 	$panel->render( 'scm/prefs.tt', $vars );
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Home.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Home.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Panel/Home.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -65,7 +65,7 @@
 	}
 	$vars->{overquota} = \@overquota;
 
-	$vars->{url_help} = ( $vhffs->get_config->get_panel->{'url_help'} or '' );
+	$vars->{url_help} = ( $panel->get_config->{'url_help'} or '' );
 	$panel->render( 'misc/welcome.tt', $vars );
 }
 

Modified: trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -198,7 +198,7 @@
 	$panel->set_title( gettext("Modify Mercurial repository") );
 	my $vars = {};
 	$vars->{repository} = $mercurial;
-	$vars->{notify_from} = $vhffs->get_config->get_service('mercurial')->{notify_from};
+	$vars->{notify_from} = $mercurial->get_config->{notify_from};
 	$vars->{type} = 'mercurial';
 	$panel->render( 'scm/prefs.tt', $vars );
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Public.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Public.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Panel/Public.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -488,9 +488,9 @@
 	my $panel = shift;
 	my $vhffs = $panel->{vhffs};
 
-	my $url = ( $vhffs->get_config->get_panel->{'url_public'} or '' );
+	my $url = ( $panel->get_config->{'url_public'} or '' );
 
-	unless( $vhffs->get_config->get_panel->{'rss_users'} and $vhffs->get_config->get_panel->{'use_public'} ) {
+	unless( $panel->get_config->{'rss_users'} and $panel->get_config->{'use_public'} ) {
 		$panel->render('misc/message.tt', {
 			message=> gettext( 'RSS infos are not published' )
 		});
@@ -546,9 +546,9 @@
 	my $panel = shift;
 	my $vhffs = $panel->{vhffs};
 
-	my $url = ( $vhffs->get_config->get_panel->{'url_public'} or '' );
+	my $url = ( $panel->get_config->{'url_public'} or '' );
 
-	unless( $vhffs->get_config->get_panel->{'rss_groups'} and $vhffs->get_config->get_panel->{'use_public'} ) {
+	unless( $panel->get_config->{'rss_groups'} and $panel->get_config->{'use_public'} ) {
 		$panel->render('misc/message.tt', {
 			message=> gettext( 'RSS infos are not published' )
 		});

Modified: trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -55,9 +55,9 @@
 	my $submitted = $cgi->param( 'create_submit' );
 	my $message;
 
-	my $usecaptcha = $vhffs->get_config->get_panel->{'use_captcha'};
-	my $captcha_pubkey = $vhffs->get_config->get_panel->{'captcha_pubkey'};
-	my $captcha_privkey = $vhffs->get_config->get_panel->{'captcha_privkey'};
+	my $usecaptcha = $panel->get_config->{'use_captcha'};
+	my $captcha_pubkey = $panel->get_config->{'captcha_pubkey'};
+	my $captcha_privkey = $panel->get_config->{'captcha_privkey'};
 
 	unless( $vhffs->get_config->get_allow_subscribe )  {
 		# Subscribe isn't allowed, inform user

Modified: trunk/vhffs-api/src/Vhffs/Panel/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Svn.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Panel/Svn.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -195,7 +195,7 @@
 	$panel->set_title( gettext("Modify Subversion repository") );
 	my $vars = {};
 	$vars->{repository} = $svn;
-	$vars->{notify_from} = $vhffs->get_config->get_service('svn')->{notify_from};
+	$vars->{notify_from} = $svn->get_config->{notify_from};
 	$vars->{type} = 'svn';
 	$panel->render( 'scm/prefs.tt', $vars );
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/User.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Panel/User.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -262,7 +262,7 @@
 	my $user = shift;
 	return -1 unless defined $user;
 	my $theme = $user->get_theme;
-	$theme = $user->get_config->get_panel->{'default_theme'} unless defined $theme;
+	$theme = $user->get_vhffs->get_config->get_panel->{'default_theme'} unless defined $theme;
 	return $theme;
 }
 
@@ -610,7 +610,7 @@
 	$panel->set_title( gettext('User Preferences') );
 	$vars->{user} = $userp;
 	$vars->{current_language} = Vhffs::Panel::User::get_lang( $userp );
-	my @themes = Vhffs::Panel::list_themes( $vhffs );
+	my @themes = $panel->get_available_themes;
 	$vars->{themes} = \@themes;
 	$vars->{current_theme} = Vhffs::Panel::User::get_theme( $userp );
 	$vars->{user_help_url} = $vhffs->get_config->get_users()->{url_doc};

Modified: trunk/vhffs-api/src/Vhffs/Panel.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Panel.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -40,6 +40,18 @@
 
 =pod
 
+=head2 get_config
+
+	$panel->get_config;
+
+Returns panel configuration.
+
+=cut
+sub get_config {
+	my $panel = shift;
+	return $panel->{vhffs}->get_config->get_panel;
+}
+
 =head2 check_public
 
 	$panel->check_public;
@@ -49,7 +61,7 @@
 =cut
 sub check_public {
 	my $panel = shift;
-	return $panel->{vhffs}->get_config->get_panel->{'use_public'};
+	return $panel->get_config->{'use_public'};
 }
 
 =pod
@@ -63,7 +75,7 @@
 =cut
 sub is_open {
 	my $panel = shift;
-	return $panel->{vhffs}->get_config->get_panel->{'open'};
+	return $panel->get_config->{'open'};
 }
 
 =pod
@@ -77,7 +89,7 @@
 =cut
 sub is_public {
 	my $panel = shift;
-	return $panel->{vhffs}->get_config->get_panel->{'use_public'};
+	return $panel->get_config->{'use_public'};
 }
 
 =pod
@@ -91,7 +103,7 @@
 =cut
 sub use_avatars {
 	my $panel = shift;
-	return ( $panel->{vhffs}->get_config->get_panel->{'users_avatars'} or $panel->{vhffs}->get_config->get_panel->{'groups_avatars'} );
+	return ( $panel->get_config->{'users_avatars'} or $panel->get_config->{'groups_avatars'} );
 }
 
 =pod
@@ -105,7 +117,7 @@
 =cut
 sub use_users_avatars {
 	my $panel = shift;
-	return $panel->{vhffs}->get_config->get_panel->{'users_avatars'};
+	return $panel->get_config->{'users_avatars'};
 }
 
 =pod
@@ -119,7 +131,7 @@
 =cut
 sub use_groups_avatars {
 	my $panel = shift;
-	return $panel->{vhffs}->get_config->get_panel->{'groups_avatars'};
+	return $panel->get_config->{'groups_avatars'};
 }
 
 =pod
@@ -167,42 +179,23 @@
 	return 1;
 }
 
-sub list_themes {
-	my $vhffs = shift;
-	return -1 unless defined $vhffs;
-
+sub get_available_themes {
+	my $panel = shift;
 	my @themes;
 
-	my $dir = $vhffs->get_config->get_panel->{'themesdir'};
-	return undef unless defined $dir;
-
-	opendir( DIR , $dir) or return -2;
-	my @files = readdir( DIR );
-	foreach( @files )
-	{
-		next if( /\./);
-		if( -d $dir."/".$_ )
-		{
-			push @themes , $_;
-		}
+	my $path = $panel->get_config->{'themesdir'};
+	opendir( my $dir, $path ) or return;
+	my @files = readdir( $dir );
+	foreach( @files ) {
+		next if /^\./;
+		next unless -d $path.'/'.$_;
+		push @themes, $_;
 	}
-
-	closedir( DIR );
+	closedir( $dir );
 	return @themes;
 }
 
-
-sub list_languages {
-	my $vhffs = shift;
-	return -1 if( ! defined $vhffs );
-
-	return $vhffs->get_config->get_available_languages;
-}
-
-
-
-sub new
-{
+sub new {
 	my $class = ref($_[0]) || $_[0];
 	my $vhffs = $_[1];
 	my $cgi = $_[2];
@@ -222,16 +215,15 @@
 	$self->{url} = $cgi->url();
 	$self->{display_admin_menu} = 0;
 
-	my $config = $vhffs->get_config;
-	$self->{config} = $config;
-	my $templatedir = $config->get_templatedir;
+	# FIXME: maybe we should move templatedir to <panel/> configuration ?
+	my $templatedir = $vhffs->get_config->get_templatedir;
 	$self->{templatedir} = $templatedir;
 
 	# lang cookie
 	my $lang = $cgi->param('lang');
 	$self->add_cookie( $cgi->cookie( -name=>'language', -value=>$lang, -expires=>'+10y' ) ) if defined $lang;
 	$lang = $cgi->cookie('language') unless defined $lang;
-	$lang = $vhffs->get_config->get_default_language() unless defined $lang;
+	$lang = $vhffs->get_config->get_default_language unless defined $lang;
 	$lang = 'en_US' unless defined $lang;
 	$self->{lang} = $lang;
 
@@ -243,13 +235,13 @@
 	my $theme = $cgi->param('theme');
 	$self->add_cookie( $cgi->cookie( -name=>'theme', -value=>$theme, -expires=>'+10y' ) ) if defined $theme;
 	$theme = $cgi->cookie('theme') unless defined $theme;
-	$theme = $config->get_panel->{'default_theme'} unless defined $theme;
-	$theme = 'vhffs' unless( defined $theme and -f $config->get_panel->{'themesdir'}.'/'.$theme.'/main.css' );
+	$theme = $self->get_config->{'default_theme'} unless defined $theme;
+	$theme = 'vhffs' unless( defined $theme and -f $self->get_config->{'themesdir'}.'/'.$theme.'/main.css' );
 
 	# theme feature is more or less deprecated since we never had more than one theme working, let me force to the current theme
 	$self->{theme} = 'light-grey';
 
-	unless( $vhffs->reconnect() and $vhffs->get_config->get_panel->{'open'} )  {
+	unless( $vhffs->reconnect() and $self->get_config->{'open'} )  {
 		$self->render('misc/closed.tt', undef, 'anonymous.tt');
 		undef $self;
 		return undef;
@@ -366,7 +358,6 @@
 sub render {
 	my ($self, $file, $vars, $layout, $include_path) = @_;
 	my $vhffs = $self->{vhffs};
-	my $conf = $vhffs->get_config;
 	my $cgi = $self->{cgi};
 	$vhffs->clear_current_user;
 
@@ -464,10 +455,10 @@
 	$vars->{do} = $cgi->url_param('do');
 	$vars->{query_string} = $query_string;
 	$vars->{theme} = $self->{theme};
-	$vars->{panel_url} = $conf->get_panel->{url};
-	$vars->{title} = sprintf( gettext( '%s\'s Panel' ), $conf->get_host_name );
+	$vars->{panel_url} = $self->get_config->{url};
+	$vars->{title} = sprintf( gettext( '%s\'s Panel' ), $vhffs->get_config->get_host_name );
 	$vars->{page_title} = $self->{title};
-	$vars->{public_url} = $vhffs->get_config->get_panel->{'url_public'} if $self->is_public;
+	$vars->{public_url} = $self->get_config->{'url_public'} if $self->is_public;
 	$vars->{msg} = Encode::decode_utf8($self->{cgi}->param('msg')) if defined $self->{cgi}->param('msg');
 	my @langs = $vhffs->get_config->get_available_languages;
 	$vars->{languages} = \@langs;
@@ -486,9 +477,9 @@
 		} else {
 			$create_vars->{PROCESS} = 'layouts/panel.tt';
 			$vars->{panel_header} = {
-				help_url => $conf->get_panel->{'url_help'} || 'http://www.vhffs.org/',
+				help_url => $self->get_config->{'url_help'} || 'http://www.vhffs.org/',
 				admin_menu => $self->{display_admin_menu},
-				available_services => $conf->get_available_services
+				available_services => $vhffs->get_config->get_available_services
 			};
 		}
 	}

Modified: trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -131,7 +131,7 @@
 
 	my $vhffs = $bazaar->get_vhffs;
 	my $dir = $bazaar->get_dir;
-	my $mail_from = $bazaar->get_config->get_service('bazaar')->{notify_from};
+	my $mail_from = $bazaar->get_config->{notify_from};
 
 	if( $bazaar->get_ml_name !~ /^\s*$/ ) {
 		# TODO: Bazaar mail on commit

Modified: trunk/vhffs-api/src/Vhffs/Robots/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Git.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Robots/Git.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -151,7 +151,7 @@
 		$git->add_history( 'Is now private');
 	}
 
-	my $mail_from = $git->get_config->get_service('git')->{'notify_from'};
+	my $mail_from = $git->get_config->{'notify_from'};
 
 	# Always unlink since git init create a dummy post-receive
 	unlink $dir.'/hooks/post-receive';

Modified: trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -145,7 +145,7 @@
 		$mercurial->add_history( 'Is now private');
 	}
 
-	my $mail_from = $mercurial->get_config->get_service('mercurial')->{notify_from};
+	my $mail_from = $mercurial->get_config->{notify_from};
 	my $mladdress = $mercurial->{ml_name};
 
 	my $rcfileoutpath = $dir.'/.hg/hgrc';

Modified: trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -171,7 +171,7 @@
 
 sub _dump {
 	my $mysql = shift;
-	my $mysqlconf = $mysql->get_config->get_service('mysql');
+	my $mysqlconf = $mysql->get_config;
 	return undef unless defined $mysqlconf;
 
 	my $dbconf = {};

Modified: trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -88,7 +88,7 @@
 	return undef unless defined $pgsql and $pgsql->get_status == Vhffs::Constants::WAITING_FOR_DELETION;
 
 	my $vhffs = $pgsql->get_vhffs;
-	my $pgsqlconfig = $vhffs->get_config->get_service('pgsql');
+	my $pgsqlconfig = $pgsql->get_config;
 
 	my $dbi = pgsql_admin_db_connect( $vhffs );
 	return unless $dbi;
@@ -167,7 +167,7 @@
 
 sub _dump {
 	my $pg = shift;
-	my $pgsqlconf = $pg->get_config->get_service('pgsql');
+	my $pgsqlconf = $pg->get_config;
 	return undef unless defined $pgsqlconf;
 
 	my $dbconf = {};

Modified: trunk/vhffs-api/src/Vhffs/Robots/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Svn.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Robots/Svn.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -188,7 +188,7 @@
 	}
 
 	# Commit mail
-	my $svnconf = $svn->get_config->get_service('svn');
+	my $svnconf = $svn->get_config;
 	my $mailfrom = $svnconf->{'notify_from'};
 	my $mailto = $svn->{ml_name};
 	if( defined $mailfrom and defined $mailto )  {

Modified: trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -203,6 +203,16 @@
 	return $self->{reponame};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('bazaar');
+}
+
 sub get_dir {
 	my $self = shift;
 	return $self->get_base_dir.'/'.$self->get_reponame;
@@ -217,7 +227,7 @@
 =cut
 sub get_base_dir {
 	my $self = shift;
-	return $self->get_config->get_datadir.'/bazaar/bazaarroot';
+	return $self->get_vhffs->get_config->get_datadir.'/bazaar/bazaarroot';
 }
 
 1;

Modified: trunk/vhffs-api/src/Vhffs/Services/Cron.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Cron.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Cron.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -215,6 +215,16 @@
 	return $self->{'cronpath'};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('cron');
+}
+
 sub get_cronpath {
 	my $self = shift;
 	return $self->{'cronpath'};
@@ -232,7 +242,7 @@
 
 sub set_interval {
 	my ($self, $value) = @_;
-	my $mininterval = $self->get_config->get_service('cron')->{'minimum_interval'}*60;
+	my $mininterval = $self->get_config->{'minimum_interval'}*60;
 	$value = $mininterval if( $value < $mininterval );
 	$self->{'interval'} = $value;
 	return 0;

Modified: trunk/vhffs-api/src/Vhffs/Services/Cvs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Cvs.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Cvs.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -226,6 +226,16 @@
 	return $self->{cvsroot};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('cvs');
+}
+
 sub get_reponame {
 	my ($self) = @_;
 	return $self->{'cvsroot'};
@@ -245,7 +255,7 @@
 =cut
 sub get_base_dir {
 	my $self = shift;
-	return $self->get_config->get_datadir.'/cvs/cvsroot';
+	return $self->get_vhffs->get_config->get_datadir.'/cvs/cvsroot';
 }
 
 1;

Modified: trunk/vhffs-api/src/Vhffs/Services/DNS.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/DNS.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/DNS.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -437,7 +437,7 @@
 	return -2 if ( $self->name_exists( $name, 'A', 'CNAME' ) != 0 );
 
 	unless( defined $ip ) {
-		my $dnsconfig = $self->get_config->get_service('dns');
+		my $dnsconfig = $self->get_config;
 		if( defined $dnsconfig->{'default_a'} ) {
 		    $ip = $dnsconfig->{'default_a'};
 		} else {
@@ -649,7 +649,7 @@
 	return -2 if ( $self->name_exists( $name, 'CNAME', 'AAAA' ) != 0 );
 
 	unless( defined $ip ) {
-		my $dnsconfig = $self->get_config->get_service('dns');
+		my $dnsconfig = $self->get_config;
 		if( defined $dnsconfig->{'default_aaaa'} ) {
 		    $ip = $dnsconfig->{'default_aaaa'};
 		} else {
@@ -839,7 +839,7 @@
 	my $self = shift;
 	return -1 unless ( defined $self && defined $self->{'dns_id'} );
 
-	my $conf = $self->get_config->get_service('dns');
+	my $conf = $self->get_config;
 	return -1 unless defined $conf;
 
 	#Update the serial to refresh the domain
@@ -886,6 +886,16 @@
 	return $self->{domain};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('dns');
+}
+
 sub get_dns_id {
 	my $self = shift;
 	return $self->{dns_id};

Modified: trunk/vhffs-api/src/Vhffs/Services/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Git.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Git.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -195,6 +195,16 @@
 	return $self->{reponame};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('git');
+}
+
 sub get_reponame {
 	my $self = shift;
 	return $self->{'reponame'};
@@ -219,7 +229,7 @@
 =cut
 sub get_base_dir {
 	my $self = shift;
-	return $self->get_config->get_datadir.'/git/gitroot';
+	return $self->get_vhffs->get_config->get_datadir.'/git/gitroot';
 }
 
 1;

Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mail.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -843,7 +843,7 @@
 	$self->{localpart} = {};
 	$self->{catchall} = {};
 
-	my $mail_config = $vhffs->get_config->get_service('mail');
+	my $mail_config = $self->get_config;
 	my $allowed_catchall = CATCHALL_ALLOW_DOMAIN;
 	$allowed_catchall = CATCHALL_ALLOW_NONE if $mail_config->{allowed_catchall} =~ /^none$/i;
 	$allowed_catchall = CATCHALL_ALLOW_OPEN if $mail_config->{allowed_catchall} =~ /^open$/i;
@@ -1121,7 +1121,7 @@
 =cut
 sub get_config {
 	my $self = shift;
-	return $self->{vhffs}->get_config->get_service('mail');
+	return $self->get_vhffs->get_config->get_service('mail');
 }
 
 =head2 get_domain

Modified: trunk/vhffs-api/src/Vhffs/Services/MailingList.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/MailingList.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/MailingList.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -504,6 +504,16 @@
 	return $self->{localpart}.'@'.$self->{domain};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('mailinglist');
+}
+
 sub get_listname {
 	my $self = shift;
 	return $self->get_localpart.'@'.$self->get_domain;

Modified: trunk/vhffs-api/src/Vhffs/Services/Mercurial.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mercurial.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Mercurial.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -194,6 +194,16 @@
 	return $self->{reponame};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('mercurial');
+}
+
 sub get_reponame {
 	my $self = shift;
 	return $self->{'reponame'};
@@ -218,7 +228,7 @@
 =cut
 sub get_base_dir {
 	my $self = shift;
-	return $self->get_config->get_datadir.'/mercurial/mercurialroot';
+	return $self->get_vhffs->get_config->get_datadir.'/mercurial/mercurialroot';
 }
 
 1;

Modified: trunk/vhffs-api/src/Vhffs/Services/Mysql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mysql.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Mysql.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -244,6 +244,16 @@
 	return $self->{dbname};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('mysql');
+}
+
 sub get_dbpassword {
 	my $self = shift;
 	return $self->{'dbpass'};

Modified: trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -58,7 +58,7 @@
 
 	return undef unless defined $vhffs and defined $user and $vhffs->get_config->get_service_availability('newsletter');
 	my $config = $vhffs->get_config->get_service('newsletter');
-	return unless defined $config->{'mailinglist'};
+	return unless defined $config and defined $config->{'mailinglist'};
 
 	# Fetches the mail domain defined in config
 	my ( $localpart, $domain ) = ( $config->{'mailinglist'} =~ /(.+)\@(.+)/ );
@@ -68,7 +68,6 @@
 
 	my $this = {};
 	$this->{vhffs} = $vhffs;
-	$this->{config} = $config;
 	$this->{user} = $user;
 	$this->{collectmode} = ACTIVE_OPTIN;
 	if( defined $config->{'collectmode'} ) {
@@ -82,6 +81,16 @@
 	return $this;
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->{vhffs}->get_config->get_service('newsletter');
+}
+
 sub exists {
 	my $self = shift;
 	return defined $self->{'mailinglist_service'}->get_members->{ $self->{'user'}->get_mail };

Modified: trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -249,6 +249,16 @@
 	return $self->{dbname};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('pgsql');
+}
+
 sub get_dbpassword {
 	my $self = shift;
 	return $self->{'dbpass'};

Modified: trunk/vhffs-api/src/Vhffs/Services/Repository.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Repository.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Repository.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -103,7 +103,7 @@
 		my $sql = 'INSERT INTO vhffs_repository(name, quota, quota_used, object_id) VALUES(?, ?, 0, ?)';
 
 		#Quota
-		my $config = $vhffs->get_config()->get_service('repository');
+		my $config = $vhffs->get_config->get_service('repository');
 		my $quota = $config->{'default_quota'} if defined($config);
 		$quota = 100 unless defined $quota;
 
@@ -111,7 +111,7 @@
 		$sth->execute($rname, $quota, $parent->get_oid);
 
 		$dbh->commit;
-		$repo =  get_by_reponame($vhffs, $rname);
+		$repo = get_by_reponame($vhffs, $rname);
 	};
 
 	if($@) {
@@ -205,6 +205,16 @@
 	return $self->{name};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('repository');
+}
+
 sub get_name {
 	my $self = shift;
 	return $self->{'name'};
@@ -232,7 +242,7 @@
 
 sub get_dir {
 	my $self = shift;
-	return $self->get_config->get_datadir.'/repository/'.$self->get_name;
+	return $self->get_vhffs->get_config->get_datadir.'/repository/'.$self->get_name;
 }
 
 1;

Modified: trunk/vhffs-api/src/Vhffs/Services/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Svn.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Svn.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -196,6 +196,16 @@
 	return $self->{reponame};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('svn');
+}
+
 sub get_reponame {
 	my $self = shift;
 	return $self->{'reponame'};
@@ -228,7 +238,7 @@
 =cut
 sub get_base_dir {
 	my $self = shift;
-	return $self->get_config->get_datadir.'/svn/svnroot';
+	return $self->get_vhffs->get_config->get_datadir.'/svn/svnroot';
 }
 
 1;

Modified: trunk/vhffs-api/src/Vhffs/Services/Web.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Web.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/Services/Web.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -211,7 +211,7 @@
 	my $self = shift;
 	require Digest::MD5;
 	my $hash = Digest::MD5::md5_hex( $self->{'servername'} );
-	return $self->get_config->get_datadir.'/web/'.$self->get_hash();
+	return $self->get_vhffs->get_config->get_datadir.'/web/'.$self->get_hash();
 }
 
 =head2 get_hash
@@ -238,6 +238,16 @@
 	return $self->{servername};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_service('web');
+}
+
 1;
 
 __END__

Modified: trunk/vhffs-api/src/Vhffs/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/User.pm	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-api/src/Vhffs/User.pm	2012-04-28 23:25:19 UTC (rev 2162)
@@ -366,7 +366,7 @@
 sub commit {
 	my $self = shift;
 
-	$self->{'shell'} = $self->get_config->get_users->{'default_shell'} unless defined $self->{'shell'};
+	$self->{'shell'} = $self->get_config->{'default_shell'} unless defined $self->{'shell'};
 	$self->{'admin'} = 0 unless defined $self->{'admin'};
 
 	return -1 unless defined $self->{'passwd'} and $self->{'passwd'} ne '';
@@ -992,6 +992,16 @@
 	return $self->{username};
 }
 
+=head2 get_config
+
+See C<Vhffs::Object::get_config>.
+
+=cut
+sub get_config {
+	my $self = shift;
+	return $self->get_vhffs->get_config->get_users;
+}
+
 =pod
 
 =head2 is_admin

Modified: trunk/vhffs-irc/modobot.pl
===================================================================
--- trunk/vhffs-irc/modobot.pl	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-irc/modobot.pl	2012-04-28 23:25:19 UTC (rev 2162)
@@ -83,7 +83,7 @@
 			my $duration = delay_modo($obj->get_date);
 
 			my $msg = '['.$duration.'] '.Vhffs::Functions::type_string_from_type_id( $obj->{type} ).':   '.$obj->get_oid.'   '.$user->get_username;
-			$msg .= ' ('.$user->get_note.')' if $vhffs->get_config->get_users->{'use_notation'};
+			$msg .= ' ('.$user->get_note.')' if $user->get_config->{'use_notation'};
 			$msg .= ' ['.$user->get_lang.']   '.$group->get_groupname.'   '.$object->get_label.'   '.$obj->get_description;
 			$msg .= "\n[".format_tags_list($group).']';
 			irc_msg( $msg );

Modified: trunk/vhffs-listengine/src/listengine.pl
===================================================================
--- trunk/vhffs-listengine/src/listengine.pl	2012-04-26 21:10:54 UTC (rev 2161)
+++ trunk/vhffs-listengine/src/listengine.pl	2012-04-28 23:25:19 UTC (rev 2162)
@@ -78,7 +78,7 @@
 {
     my $header = shift;
     my $list = shift;
-    my $mailinglistconfig = $vhffs->get_config->get_service('mailinglist');
+    my $mailinglistconfig = $list->get_config;
 
     $header->replace( 'List-Unsubscribe' ,'<mailto:'.$list->get_listrequestname.'?subject=unsubscribe>' );
     $header->replace( 'List-Subscribe' ,'<mailto:'.$list->get_listrequestname.'?subject=subscribe>' );


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