[vhffs-dev] [826] Moved listengine block to main because this is _not_ a service |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 826
Author: gradator
Date: 2007-08-30 05:26:02 +0000 (Thu, 30 Aug 2007)
Log Message:
-----------
Moved listengine block to main because this is _not_ a service
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Conf.pm
trunk/vhffs-api/src/Vhffs/Listengine/Listengine.pm
trunk/vhffs-api/src/Vhffs/Makefile.am
trunk/vhffs-backend/conf/vhffs.conf.dist.in
trunk/vhffs-listengine/src/listengine.pl
trunk/vhffs-panel/mailinglist/add_sub.pl
trunk/vhffs-robots/src/listengine_publicarchives.pl
Removed Paths:
-------------
trunk/vhffs-api/src/Vhffs/Listengine/Panel.pm
Modified: trunk/vhffs-api/src/Vhffs/Conf.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Conf.pm 2007-08-30 04:50:41 UTC (rev 825)
+++ trunk/vhffs-api/src/Vhffs/Conf.pm 2007-08-30 05:26:02 UTC (rev 826)
@@ -585,70 +585,12 @@
}
-sub get_listengine_domain
+sub get_listengine
{
- if( defined $Config{"services"}{"listengine"}{"domain"} )
- {
- return $Config{"services"}{"listengine"}{"domain"};
- }
- else
- {
- return "host.tld";
- }
+ return $Config{'listengine'};
}
-sub get_listengine_listmaster
-{
- if( defined $Config{"services"}{"listengine"}{"listmaster"} )
- {
- return $Config{"services"}{"listengine"}{"listmaster"};
- }
- else
- {
- return "listmaster\@unknownhost.tld";
- }
-}
-
-sub get_listengine_datadir
-{
- if( defined $Config{"services"}{"listengine"}{"datadir"} )
- {
- return $Config{"services"}{"listengine"}{"datadir"};
- }
- else
- {
- return $Config{"global"}{datadir}."/listengine/";
- }
-}
-
-
-
-sub get_listengine_smtp
-{
- if( defined $Config{"services"}{"listengine"}{"smtp_server"} )
- {
- return $Config{"services"}{"listengine"}{"smtp_server"};
- }
- else
- {
- return "localhost";
- }
-}
-
-sub get_listengine_templatesdir
-{
- if( defined $Config{"services"}{"listengine"}{"templatesdir"} )
- {
- return $Config{"services"}{"listengine"}{"templatesdir"};
- }
- else
- {
- return undef;
- }
-}
-
-
sub get_cvsweburl
{
if( defined $Config{"services"}{"cvs"}{"cvsweb_url"} )
Modified: trunk/vhffs-api/src/Vhffs/Listengine/Listengine.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Listengine/Listengine.pm 2007-08-30 04:50:41 UTC (rev 825)
+++ trunk/vhffs-api/src/Vhffs/Listengine/Listengine.pm 2007-08-30 05:26:02 UTC (rev 826)
@@ -46,13 +46,13 @@
sub get_moderation_dir
{
my $list = shift;
- return( $list->get_main->get_config->get_listengine_datadir . "/moderation/" . $list->get_domain . "/" . $list->get_localpart );
+ return( $list->get_main->get_config->get_listengine->{'datadir'} . "/moderation/" . $list->get_domain . "/" . $list->get_localpart );
}
sub get_archives_dir
{
my $list = shift;
- return( $list->get_main->get_config->get_listengine_datadir . "/archives/" . $list->get_domain . "/" . $list->get_localpart );
+ return( $list->get_main->get_config->get_listengine->{'datadir'} . "/archives/" . $list->get_domain . "/" . $list->get_localpart );
}
Deleted: trunk/vhffs-api/src/Vhffs/Listengine/Panel.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Listengine/Panel.pm 2007-08-30 04:50:41 UTC (rev 825)
+++ trunk/vhffs-api/src/Vhffs/Listengine/Panel.pm 2007-08-30 05:26:02 UTC (rev 826)
@@ -1,145 +0,0 @@
-#!%PERL%
-# 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
-# are met:
-#
-# 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
-# distribution.
-#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
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-
-package Vhffs::Listengine::Panel;
-
-#Vhffs::User written by sod` <dieu AT gunnm DOT org>
-
-#blablabla, yeah yeah yeah
-#how to you feel today ? fucking weather today !
-
-use strict;
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-
-
-sub create_themes_select
-{
- my $vhffs = shift;
- my $themesdir = $vhffs->get_config->get_themesdir;
- my $templatedir = $vhffs->get_config->get_listengine_templatesdir;
- opendir( DIR , $themesdir );
- my @dirs = readdir( DIR );
- closedir( DIR );
-
- my $output = "";
- my $template = new HTML::Template( filename => $templatedir."/themes.tmpl" );
- my $subtemplate;
- my $theme;
-
- foreach $theme ( @dirs )
- {
- next if( $theme =~ /\./ );
- $subtemplate = new HTML::Template( filename => $templatedir."/theme_part.tmpl" );
- $subtemplate->param( THEME_NAME => $theme );
- $output .= $subtemplate->output;
- }
-
- $template->param( THEME => $output );
-
-
- return( $template->output );
-}
-
-sub create_lang_select
-{
- my $vhffs = shift;
- my $langdir = $vhffs->get_config->get_intldir;
- my $templatedir = $vhffs->get_config->get_listengine_templatesdir;
- opendir( DIR , $langdir );
- my @dirs = readdir( DIR );
- closedir( DIR );
-
- my $output = "";
- my $template = new HTML::Template( filename => $templatedir."/langs.tmpl" );
- my $subtemplate;
- my $lang;
-
- foreach $lang ( @dirs )
- {
- next if( $lang =~ /\./ );
- $subtemplate = new HTML::Template( filename => $templatedir."/lang_part.tmpl" );
- $subtemplate->param( LANG_NAME => $lang );
- $output .= $subtemplate->output;
- }
-
- $template->param( LANG => $output );
-
-
- return( $template->output );
-}
-
-
-sub check_theme
-{
- my $theme = shift;
- return "default" if( ! defined $theme );
- return $theme;
-}
-
-sub cook_lang
-{
- use CGI;
- my $vhffs;
- my $cgi;
- my $cookie;
- my $lang;
-
- $vhffs = shift;
- $cgi = new CGI;
-
- if( $cgi->param( "lang" ) )
- {
- $lang = $cgi->param( "lang" );
- $cookie = CGI->cookie( -name => "lang" ,
- -expires => "+1y",
- -value => $lang );
- }
- elsif( CGI->cookie( "lang" ) )
- {
- $lang = CGI->cookie( "lang" );
- }
- else
- {
- $lang = "en_US";
- }
- setlocale(LC_ALL, $lang );
- bindtextdomain("vhffs", $vhffs->get_config->get_intldir);
- textdomain("vhffs");
- return $cookie;
-}
-
-
-1;
Modified: trunk/vhffs-api/src/Vhffs/Makefile.am
===================================================================
--- trunk/vhffs-api/src/Vhffs/Makefile.am 2007-08-30 04:50:41 UTC (rev 825)
+++ trunk/vhffs-api/src/Vhffs/Makefile.am 2007-08-30 05:26:02 UTC (rev 826)
@@ -22,7 +22,6 @@
Listengine/Intl.pm \
Listengine/Listengine.pm \
Listengine/Mail.pm \
- Listengine/Panel.pm \
Misc/Listengine.pm \
Misc/Mailings.pm \
Misc/Salt.pm \
Modified: trunk/vhffs-backend/conf/vhffs.conf.dist.in
===================================================================
--- trunk/vhffs-backend/conf/vhffs.conf.dist.in 2007-08-30 04:50:41 UTC (rev 825)
+++ trunk/vhffs-backend/conf/vhffs.conf.dist.in 2007-08-30 05:26:02 UTC (rev 826)
@@ -2,7 +2,12 @@
# This is the default configuration file for VHFFS
# Please ask vhffs@xxxxxxxxx for questions
# Visit http://www.vhffs.org
-###############################
+#####################################################
+
+
+######
+# GLOBAL
+################################
<global>
#This is the name of your hosting service
host_name = My Hosting service
@@ -106,11 +111,9 @@
</global>
-
-
+######
+# BACKEND
#################################################
-# Backend configuration
-#################################################
<database>
driver = pg
@@ -131,7 +134,7 @@
</database>
-################################################
+######
# USERS AND GROUPS
################################################
#the default configuration for users
@@ -155,7 +158,7 @@
</group>
-#####################################
+######
# SERVICES
#####################################
<services>
@@ -354,26 +357,31 @@
url_doc = http://help.myhoster.net/repository
</repository>
- #Configuration for listengine
- <listengine>
- #The domain is used when listengine bounces mails to SMTP server
- #Listengine will send HELO domain to the SMTP sever
- domain = "myhost.tld"
+</services>
- #Where we store listengine data
- datadir = "/data/listengine"
- #Email of listmaster
- listmaster = "listmaster@xxxxxxxxxx"
+######
+# LISTENGINE
+#################################
+<listengine>
+ #The domain is used when listengine bounces mails to SMTP server
+ #Listengine will send HELO domain to the SMTP sever
+ domain = "myhost.tld"
- #SMTP Server to bounce listengine mails
- smtp_server = "localhost"
- </listengine>
+ #Where we store listengine data
+ datadir = "/data/listengine"
-</services>
+ #Email of listmaster
+ listmaster = "listmaster@xxxxxxxxxx"
+ #SMTP Server to bounce listengine mails
+ smtp_server = "localhost"
+</listengine>
-#Robots configuration
+
+######
+# ROBOTS
+#################################
<robots>
#Robots should log or not ?
use_logging = yes
@@ -386,4 +394,3 @@
use_lock = yes
lockfile = /var/lock/vhffs
</robots>
-
Modified: trunk/vhffs-listengine/src/listengine.pl
===================================================================
--- trunk/vhffs-listengine/src/listengine.pl 2007-08-30 04:50:41 UTC (rev 825)
+++ trunk/vhffs-listengine/src/listengine.pl 2007-08-30 05:26:02 UTC (rev 826)
@@ -50,7 +50,7 @@
if( $#ARGV != 2 )
{
print "involve as: listengine action local_part domain\n";
- exit 0;
+ exit 1;
}
my $action = shift;
@@ -58,16 +58,20 @@
my $domain = shift;
my $vhffs = init Vhffs::Main;
-my $DOMAIN = $vhffs->get_config->get_listengine_domain;
-my $LISTMASTER = $vhffs->get_config->get_listengine_listmaster;
-my $ADMIN = $vhffs->get_config->get_listengine_listmaster;
-my $SMTP_SERVER = $vhffs->get_config->get_listengine_smtp;
+my $listengineconfig = $vhffs->get_config->get_listengine;
+my $DOMAIN = $listengineconfig->{'domain'};
+my $LISTMASTER = $listengineconfig->{'listmaster'};
+my $ADMIN = $listengineconfig->{'listmaster'};
+my $SMTP_SERVER = $listengineconfig->{'smtp_server'};
+
# Be careful, listengine will create /data/listengine/archives for archives
-#and /data/listengine/tomoderate for moderation
-my $DIRECTORY = $vhffs->get_config->get_listengine_datadir;
+# and /data/listengine/tomoderate for moderation
+my $DIRECTORY = $listengineconfig->{'datadir'};
+exit 2 unless( defined $DOMAIN && defined $LISTMASTER && defined $ADMIN && defined $SMTP_SERVER && defined $DIRECTORY );
+
sub add_list_header
{
my $header = shift;
Modified: trunk/vhffs-panel/mailinglist/add_sub.pl
===================================================================
--- trunk/vhffs-panel/mailinglist/add_sub.pl 2007-08-30 04:50:41 UTC (rev 825)
+++ trunk/vhffs-panel/mailinglist/add_sub.pl 2007-08-30 05:26:02 UTC (rev 826)
@@ -91,6 +91,8 @@
$message = gettext("You're not allowed to do this (ACL rights)");
}
+my $listengineconfig = $vhffs->get_config->get_listengine;
+
my @members = split /\r\n/, $memberlist;
foreach my $member ( @members ) {
chomp $member;
@@ -104,7 +106,7 @@
else {
$message .= sprintf( gettext( "%s has been successfully added" ), $member );
Vhffs::Functions::send_mail(
- $vhffs->get_config->get_listengine_listmaster,
+ $listengineconfig->{'listmaster'},
$member,
sprintf(gettext('[%s] You\'ve been added to the list %s'), $list->get_prefix, $list->get_localpart.'@'.$list->get_domain),
sprintf(gettext("Greetings,\n\nYou've been added to the list %s on platform %s.\n\nYou may get some help on listengine by sending an email to %s-request\@%s with subject help.\n\nCheers."), $list->get_localpart.'@'.$list->get_domain, $vhffs->get_config->get_host_name, $list->get_localpart, $list->get_domain),
Modified: trunk/vhffs-robots/src/listengine_publicarchives.pl
===================================================================
--- trunk/vhffs-robots/src/listengine_publicarchives.pl 2007-08-30 04:50:41 UTC (rev 825)
+++ trunk/vhffs-robots/src/listengine_publicarchives.pl 2007-08-30 05:26:02 UTC (rev 826)
@@ -26,8 +26,9 @@
my $outputmonthdir;
my $cmd;
-my $archivedir = $vhffs->get_config->get_listengine_datadir."/archives";
-my $outputdir = $vhffs->get_config->get_listengine_datadir."/public";
+my $listengineconfig = $vhffs->get_config->get_listengine;
+my $archivedir = $listengineconfig->{'datadir'}."/archives";
+my $outputdir = $listengineconfig->{'datadir'}."/public";
my $leconfig = $vhffs->get_config->get_service('listengine');
die "Cannot find listengine configuration" unless( $leconfig );