Mail::Ezmlm release 0.07 finished

This commit is contained in:
lars 2006-01-15 22:37:23 +00:00
parent 5f1815769d
commit f00e44b1ca
4 changed files with 99 additions and 32 deletions

View file

@ -38,4 +38,7 @@ Revision history for Perl extension Mail::Ezmlm.
0.07 Mon Jan 2 22:12:32 CET 2006 0.07 Mon Jan 2 22:12:32 CET 2006
- new functions for text management (idx >= 5.0) - new functions for text management (idx >= 5.0)
- new functions for language setting (idx >= 5.0) - new functions for language setting (idx >= 5.0)
- new functions for charset setting (idx >= 5.0)
- new functions for config directory setting (idx >= 5.0) - new functions for config directory setting (idx >= 5.0)
- look for ezmlm-make at run-time
- requires Text::ParseWords

View file

@ -41,6 +41,7 @@ package Mail::Ezmlm;
use strict; use strict;
use vars qw($QMAIL_BASE $EZMLM_BASE $MYSQL_BASE $VERSION @ISA @EXPORT @EXPORT_OK); use vars qw($QMAIL_BASE $EZMLM_BASE $MYSQL_BASE $VERSION @ISA @EXPORT @EXPORT_OK);
use Carp; use Carp;
use Text::ParseWords;
require Exporter; require Exporter;
@ -61,7 +62,13 @@ $QMAIL_BASE = '/var/qmail'; #Autoinserted by Makefile.PL
$MYSQL_BASE = ''; #Autoinserted by Makefile.PL $MYSQL_BASE = ''; #Autoinserted by Makefile.PL
# == End site dependant variables == # == End site dependant variables ==
use Carp; # == check the ezmlm-make path ==
$EZMLM_BASE = '/usr/local/bin/ezmlm' unless (-e "$EZMLM_BASE/ezmlm-make");
$EZMLM_BASE = '/usr/local/bin/ezmlm-idx' unless (-e "$EZMLM_BASE/ezmlm-make");
$EZMLM_BASE = '/usr/local/bin' unless (-e "$EZMLM_BASE/ezmlm-make");
$EZMLM_BASE = '/usr/bin/ezmlm' unless (-e "$EZMLM_BASE/ezmlm-make");
$EZMLM_BASE = '/usr/bin/ezmlm-idx' unless (-e "$EZMLM_BASE/ezmlm-make");
$EZMLM_BASE = '/usr/bin' unless (-e "$EZMLM_BASE/ezmlm-make");
# == clean up the path for taint checking == # == clean up the path for taint checking ==
local $ENV{'PATH'} = $EZMLM_BASE; local $ENV{'PATH'} = $EZMLM_BASE;
@ -134,14 +141,25 @@ sub update {
# Do we have the command line switches # Do we have the command line switches
($self->_seterror(-1, 'nothing to update()') && return 0) unless(defined($switches)); ($self->_seterror(-1, 'nothing to update()') && return 0) unless(defined($switches));
$switches = '-e' . $switches; $switches = '-e' . $switches;
my @switches; my @switch_list;
# UGLY! # UGLY!
foreach (split(/["'](.+?)["']|(-\w+)/, $switches)) { #foreach (split(/["'](.+?)["']|(-\w+)/, $switches)) {
next if (!defined($_) or !$_ or $_ eq ' '); # next if (!defined($_));
# # untaint input
# $_ =~ m/^([\w _\/,\.\@:'"-]*)$/;
# push @switches, $1;
#}
foreach (&quotewords('\s+', 1, $switches)) {
next if (!defined($_));
# untaint input # untaint input
$_ =~ s/['"]//g;
$_ =~ m/^([\w _\/,\.\@:'"-]*)$/; $_ =~ m/^([\w _\/,\.\@:'"-]*)$/;
push @switches, $1; if ($_ eq '') {
push @switch_list, " ";
} else {
push @switch_list, $1;
}
} }
# can we actually alter this list; # can we actually alter this list;
@ -162,9 +180,9 @@ sub update {
} }
# Attempt to update the list if we can. # Attempt to update the list if we can.
system("$EZMLM_BASE/ezmlm-make", @switches, $self->{'LIST_NAME'}) == 0 system("$EZMLM_BASE/ezmlm-make", @switch_list, $self->{'LIST_NAME'}) == 0
|| ($self->_seterror($?) && return undef); || ($self->_seterror($?) && return undef);
# Sort out the DIR/inlocal problem if necessary # Sort out the DIR/inlocal problem if necessary
if(defined($inlocal)) { if(defined($inlocal)) {
open(INLOCAL, ">$self->{'LIST_NAME'}/inlocal") || ($self->_seterror(-1, 'unable to write inlocal in update()') && return 0); open(INLOCAL, ">$self->{'LIST_NAME'}/inlocal") || ($self->_seterror(-1, 'unable to write inlocal in update()') && return 0);
@ -410,8 +428,10 @@ sub getpart {
($part ne 'conf-etc') && ($part ne 'conf-lang')); ($part ne 'conf-etc') && ($part ne 'conf-lang'));
if (open(PART, "<$filename")) { if (open(PART, "<$filename")) {
while(<PART>) { while(<PART>) {
chomp($contents[$#contents++] = $_); unless ( /^#/ ) {
$content .= $_; chomp($contents[$#contents++] = $_);
$content .= $_;
}
} }
close PART; close PART;
if(wantarray) { if(wantarray) {
@ -511,7 +531,7 @@ sub get_lang {
sub set_lang { sub set_lang {
my ($self, $lang) = @_; my ($self, $lang) = @_;
return (0==0) if (get_version() < 5); return (0==0) if (get_version() < 5);
if ($lang eq 'default') { if (($lang eq 'default') || ($lang eq '')) {
return 1 if (unlink "$self->{'LIST_NAME'}/conf-lang"); return 1 if (unlink "$self->{'LIST_NAME'}/conf-lang");
} else { } else {
return 1 if ($self->setpart('conf-lang', "$lang")); return 1 if ($self->setpart('conf-lang', "$lang"));
@ -520,6 +540,42 @@ sub set_lang {
} }
# == get the selected charset of the list (idx >= 5.0) ==
# return empty string for idx < 5.0
sub get_charset {
my ($self) = shift;
my $charset;
return '' if (get_version() < 5);
chomp($charset = $self->getpart('charset'));
# default if no 'charset' file exists
$charset = 'us-ascii' if ($charset eq '');
return $charset;
}
# == set the selected charset of the list (idx >= 5.0) ==
# return without error for idx < 5.0
# remove list' specific charset file, if the default charset of the current language
# was chosen
sub set_charset {
my ($self, $charset) = @_;
return (0==0) if (get_version() < 5);
# first: remove current charset
unlink "$self->{'LIST_NAME'}/charset";
# second: get default value of the current language
my $default_charset = $self->getpart('charset');
# last: create new charset file only if the selected charset is not the default anyway
if (($charset eq $default_charset) || ($charset !~ /\S/)) {
# do not write the specific charset, as the default charset of the language is
# sufficient
return 1;
} else {
return 1 if ($self->setpart('charset', "$charset"));
}
return 0;
}
# == get list of available text files == # == get list of available text files ==
sub get_available_text_files { sub get_available_text_files {
my ($self) = shift; my ($self) = shift;
@ -769,12 +825,14 @@ sub _getconfig_idx5 {
'owner', '5', 'owner', '5',
'sql', '6', 'sql', '6',
'modpost', '7', 'modpost', '7',
'modsub', '8'); 'modsub', '8',
# "-9" seems to be ignored - this is a good change (tm) 'remote', '9');
while (($file, $opt_num) = each(%optionfiles)) { while (($file, $opt_num) = each(%optionfiles)) {
if (-e "$self->{'LIST_NAME'}/$file") { if (-e "$self->{'LIST_NAME'}/$file") {
chomp($temp = $self->getpart($file)); chomp($temp = $self->getpart($file));
$options .= " -$opt_num '$temp'" if ($temp ne ''); $temp =~ m/^(.*)$/m; # take only the first line
$temp = $1;
$options .= " -$opt_num '$temp'" if ($temp =~ /\S/);
} }
} }
@ -880,7 +938,7 @@ the ezmlm mailing list manager software. See the ezmlm web page
(http://www.ezmlm.org/) for a complete description of the software. (http://www.ezmlm.org/) for a complete description of the software.
This version of the module is designed to work with ezmlm version 0.53. This version of the module is designed to work with ezmlm version 0.53.
It is fully compatible with ezmlm's IDX extensions (version 0.40). Both It is fully compatible with ezmlm's IDX extensions (version 0.4xx and 5.0 ). Both
of these can be obtained via anon ftp from ftp://ftp.ezmlm.org/pub/patches/ of these can be obtained via anon ftp from ftp://ftp.ezmlm.org/pub/patches/
=head1 DESCRIPTION =head1 DESCRIPTION
@ -1061,11 +1119,14 @@ static function always returns the default configuration directory of ezmlm-idx
$list->get_available_languages; $list->get_available_languages;
$list->get_lang; $list->get_lang;
$list->set_lang('de'); $list->set_lang('de');
$list->get_charset;
$list->set_charset('iso-8859-1:Q');
These functions allow you to change the language of the text files, that are used These functions allow you to change the language of the text files, that are used
for automatic replies of ezmlm-idx (v5.0 or higher, the configured language is stored for automatic replies of ezmlm-idx (since v5.0 the configured language is stored
in 'conf-lang' within the mailing list's directory). Customized files (in the 'text' in 'conf-lang' within the mailing list's directory). Customized files (in the 'text'
directory of a mailing list directory) override the default language setting. directory of a mailing list directory) override the default language files.
Empty strings for set_lang() and set_charset() reset the setting to its default value.
=head2 Get the installed version of ezmlm =head2 Get the installed version of ezmlm
@ -1129,12 +1190,14 @@ that they know about nothing :)
=head1 AUTHOR =head1 AUTHOR
Guy Antony Halse <guy-ezmlm@rucus.net> Guy Antony Halse <guy-ezmlm@rucus.net>
Lars Kruse <devel@sumpfralle.de>
=head1 BUGS =head1 BUGS
May have problems with newer versions of Perl. There are no known bugs.
Please report bugs to the author. Please report bugs to the author or use the bug tracking system at
https://systemausfall.org/trac/ezmlm-web.
=head1 SEE ALSO =head1 SEE ALSO
@ -1142,6 +1205,7 @@ that they know about nothing :)
ezmlm-unsub(1), ezmlm-list(1), ezmlm-issub(1) ezmlm-unsub(1), ezmlm-list(1), ezmlm-issub(1)
http://rucus.ru.ac.za/~guy/ezmlm/ http://rucus.ru.ac.za/~guy/ezmlm/
https://systemausfall.org/toolforge/ezmlm-web
http://www.ezmlm.org/ http://www.ezmlm.org/
http://www.qmail.org/ http://www.qmail.org/

View file

@ -37,21 +37,21 @@ EOM
# guess default # guess default
$ezmlm_path = '/usr/local/bin/ezmlm'; $ezmlm_path = '/usr/local/bin/ezmlm';
$ezmlm_path = '/usr/local/bin' unless (-x "$ezmlm_path/ezmlm-make"); $ezmlm_path = '/usr/local/bin/ezmlm-idx' unless (-e "$ezmlm_path/ezmlm-make");
$ezmlm_path = '/usr/local/bin/ezmlm-idx' unless (-x "$ezmlm_path/ezmlm-make"); $ezmlm_path = '/usr/local/bin' unless (-e "$ezmlm_path/ezmlm-make");
$ezmlm_path = '/usr/bin' unless (-x "$ezmlm_path/ezmlm-make"); $ezmlm_path = '/usr/bin/ezmlm' unless (-e "$ezmlm_path/ezmlm-make");
$ezmlm_path = '/usr/bin/ezmlm' unless (-x "$ezmlm_path/ezmlm-make"); $ezmlm_path = '/usr/bin/ezmlm-idx' unless (-e "$ezmlm_path/ezmlm-make");
$ezmlm_path = '/usr/bin/ezmlm-idx' unless (-x "$ezmlm_path/ezmlm-make"); $ezmlm_path = '/usr/bin' unless (-e "$ezmlm_path/ezmlm-make");
# return to default, if nothing can be found # return to default, if nothing can be found
$ezmlm_path = '/usr/local/bin/ezmlm' unless (-x "$ezmlm_path/ezmlm-make"); $ezmlm_path = '/usr/local/bin/ezmlm' unless (-e "$ezmlm_path/ezmlm-make");
foreach (1..10) { foreach (1..10) {
$ezmlm_path = prompt('Ezmlm binary directory?', "$ezmlm_path"); $ezmlm_path = prompt('Ezmlm binary directory?', "$ezmlm_path");
last if (-x "$ezmlm_path/ezmlm-make"); last if (-e "$ezmlm_path/ezmlm-make");
print "I can't find $ezmlm_path/ezmlm-make. Please try again\n"; print "I can't find $ezmlm_path/ezmlm-make. Please try again\n";
} }
if (! -e "$ezmlm_path/ezmlm-make") { unless (-e "$ezmlm_path/ezmlm-make") {
print STDERR "Warning: No correct input after $_ attempts. Continue with warnings ...\n"; print STDERR "Warning: No correct input after $_ attempts. Continuing with warnings ...\n";
} }
print << 'EOM'; print << 'EOM';
@ -64,7 +64,7 @@ EOM
foreach (1..10) { foreach (1..10) {
$qmail_path = prompt('Qmail base directory?', '/var/qmail'); $qmail_path = prompt('Qmail base directory?', '/var/qmail');
last if (-d "$qmail_path/control"); last if (-e "$qmail_path/control");
print "I can't find $qmail_path/control. Please try again\n"; print "I can't find $qmail_path/control. Please try again\n";
} }
if (! -e "$qmail_path/control") { if (! -e "$qmail_path/control") {
@ -85,17 +85,17 @@ Mail::Ezmlm module.
EOM EOM
$mysql_path = '/usr/bin'; $mysql_path = '/usr/bin';
$mysql_path = '/usr/local/bin' unless (-x "$mysql_path/mysql"); $mysql_path = '/usr/local/bin' unless (-e "$mysql_path/mysql");
# return to default - if nothing works # return to default - if nothing works
$mysql_path = '/usr/bin' unless (-x "$mysql_path/mysql"); $mysql_path = '/usr/bin' unless (-e "$mysql_path/mysql");
foreach (1..10) { foreach (1..10) {
$mysql_path = prompt('MySQL binary directory?', "$mysql_path"); $mysql_path = prompt('MySQL binary directory?', "$mysql_path");
last if (-x "$mysql_path/mysql" || $mysql_path eq ''); last if (-e "$mysql_path/mysql" || $mysql_path eq '');
print "I can't find $mysql_path/mysql. Please enter the full path\n"; print "I can't find $mysql_path/mysql. Please enter the full path\n";
print "or leave this option blank if you don't want to use MySQL\n"; print "or leave this option blank if you don't want to use MySQL\n";
} }
unless ((-x "$mysql_path/mysql") || ($mysql_path eq '')) { unless ((-e "$mysql_path/mysql") || ($mysql_path eq '')) {
print STDERR "Warning: No correct input after $_ attempts. Continuing with warnings ...\n"; print STDERR "Warning: No correct input after $_ attempts. Continuing with warnings ...\n";
} }