Skip to content

Commit

Permalink
tidyall
Browse files Browse the repository at this point in the history
  • Loading branch information
Sympa authors authored and ikedas committed Nov 3, 2024
1 parent 5200433 commit c6713cb
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 74 deletions.
15 changes: 8 additions & 7 deletions src/cgi/wwsympa.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2017, 2018, 2019, 2020, 2021, 2022, 2023 The Sympa Community.
# Copyright 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 The Sympa Community.
# See the AUTHORS.md file at the top-level directory of this distribution
# and at <https://github.com/sympa-community/sympa.git>.
#
Expand Down Expand Up @@ -7626,7 +7626,7 @@ sub do_distribute {
# Don't need to do anything if all messages were filtered out
# by the "already_moderated" clause above.
return 'modindex' if (@mail_command == 0);

# Commands are injected into incoming spool directly with "md5"
# authentication level.
my $cmd_message = Sympa::Message->new(
Expand Down Expand Up @@ -15523,7 +15523,8 @@ sub do_arc_download {
my $string = $message->as_string =~ s/\r?\n/\r\n/gr;
if ($Archive::Zip::SimpleZip::VERSION) {
$rv = $zip->addString($string,
Name => sprintf('%s/%s.eml', $arc_dirname, $handle->basename)
Name =>
sprintf('%s/%s.eml', $arc_dirname, $handle->basename)
);
$az = $Archive::Zip::SimpleZip::SimpleZipError;
} else {
Expand Down Expand Up @@ -16680,21 +16681,21 @@ sub do_invite {
if ($in{'email'}) {
@emails =
grep {$_} map { Sympa::Tools::Text::canonic_email($_) }
split /\0/, $in{'email'};
$log->syslog('info', 'single invite "%s"', join(' ',@emails));
split /\0/, $in{'email'};
$log->syslog('info', 'single invite "%s"', join(' ', @emails));
unless (@emails) {
add_stash('user', 'no_email');
return 'review';
}
} else { # addresses for multiple users (from import.tt2) are $in{dump}
} else { # addresses for multiple users (from import.tt2) are $in{dump}
foreach (split /\r\n|\r|\n/, $in{'dump'}) {
next unless /\S/;
next if /\A\s*#/; #FIXME: email address can contain '#'

my ($email) = m{\A\s*(\S+)(?:\s+(.*))?\s*\z};
push @emails, $email;
}
$log->syslog('info', 'multiple invite "%s"', join(' ',@emails));
$log->syslog('info', 'multiple invite "%s"', join(' ', @emails));
unless (@emails) {
add_stash('user', 'no_email');
return 'import';
Expand Down
8 changes: 4 additions & 4 deletions src/lib/Sympa/CLI/instantiate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Sympa - SYsteme de Multi-Postage Automatique
#
# Copyright 2021, 2022 The Sympa Community. See the
# Copyright 2021, 2022, 2024 The Sympa Community. See the
# AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
Expand Down Expand Up @@ -128,9 +128,9 @@ sub instantiate {
} else {
$total = scalar @$list_to_generate;
$progress = Term::ProgressBar->new(
{ name => 'Creating lists',
count => $total,
ETA => 'linear',
{ name => 'Creating lists',
count => $total,
ETA => 'linear',
silent => $options{noout},
}
);
Expand Down
9 changes: 4 additions & 5 deletions src/lib/Sympa/CLI/user/del.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ use constant _args => qw(email);
use constant _need_priv => 1;

sub _run {
my $class = shift;
my $options = shift;
my $email = shift;
my $class = shift;
my $options = shift;
my $email = shift;

my @robots = Sympa::List::get_robots();

Expand All @@ -53,8 +53,7 @@ sub _run {
scenario_context => {skip => 1},
);
unless ($spindle and $spindle->spin and $class->_report($spindle)) {
printf STDERR "Failed to delete user %s\n",
$email;
printf STDERR "Failed to delete user %s\n", $email;

exit 1;
}
Expand Down
8 changes: 4 additions & 4 deletions src/lib/Sympa/Config/Schema.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Sympa - SYsteme de Multi-Postage Automatique
#
# Copyright 2020, 2021, 2022, 2023 The Sympa Community. See the
# Copyright 2020, 2021, 2022, 2023, 2024 The Sympa Community. See the
# AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
Expand Down Expand Up @@ -500,9 +500,9 @@ our %pinfo = (
not_before => '6.2.73b.1',
},
log_socket_type => {
context => [qw(site)],
obsolete => 'syslog_socket.type',
not_after => '6.2.72',
context => [qw(site)],
obsolete => 'syslog_socket.type',
not_after => '6.2.72',
},
log_level => {
context => [qw(domain site)], #FIXME "domain" possible?
Expand Down
20 changes: 10 additions & 10 deletions src/lib/Sympa/DataSource/LDAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Sympa - SYsteme de Multi-Postage Automatique
#
# Copyright 2019, 2020 The Sympa Community. See the AUTHORS.md
# Copyright 2019, 2020, 2024 The Sympa Community. See the AUTHORS.md
# file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
Expand Down Expand Up @@ -46,10 +46,12 @@ sub _open {
$self->{_db} = $db;

my $pagesize = $options{pagesize} || $self->{pagesize};
if ($pagesize and $db->__dbh->root_dse->supported_control(
if ($pagesize
and $db->__dbh->root_dse->supported_control(
Net::LDAP::Constant::LDAP_CONTROL_PAGED()
)) {
$self->{_page} = Net::LDAP::Control::Paged->new( size => $pagesize );
)
) {
$self->{_page} = Net::LDAP::Control::Paged->new(size => $pagesize);
}

my $mesg = $self->_open_operation(%options);
Expand Down Expand Up @@ -135,8 +137,7 @@ sub _load_next {
# second page, or later one (but not post-last) of a paged search:
# load next page
$mesg = $self->_open_operation(%options);
}
else {
} else {
$mesg = $self->__dsh;
}
while (my $entry = $mesg->shift_entry) {
Expand Down Expand Up @@ -182,10 +183,9 @@ sub _load_next {
}

if ($self->{_page} and $mesg) {
my $cookie = $mesg->control(
Net::LDAP::Constant::LDAP_CONTROL_PAGED
)->cookie;
$self->{_page}->cookie( $cookie );
my $cookie =
$mesg->control(Net::LDAP::Constant::LDAP_CONTROL_PAGED)->cookie;
$self->{_page}->cookie($cookie);
}

return [@retrieved];
Expand Down
8 changes: 5 additions & 3 deletions src/lib/Sympa/DataSource/List.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Sympa - SYsteme de Multi-Postage Automatique
#
# Copyright 2019 The Sympa Community. See the AUTHORS.md file at
# Copyright 2019, 2024 The Sympa Community. See the AUTHORS.md file at
# the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
Expand Down Expand Up @@ -45,9 +45,11 @@ sub _new {

my $list = $self->{context};
if (ref $list eq 'Sympa::List') {
my $inlist = Sympa::List->new($self->{listname},
my $inlist = Sympa::List->new(
$self->{listname},
($self->{listname} =~ /\@/ ? undef : $list->{'domain'}),
{just_try => 1});
{just_try => 1}
);
$self->{listname} = $inlist->get_id if $inlist;
}

Expand Down
3 changes: 1 addition & 2 deletions src/lib/Sympa/DatabaseDriver/MySQL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@ sub drop_field {
my $field = shift;

unless (
$self->do_query(q{ALTER TABLE %s DROP COLUMN `%s`}, $table, $field)
) {
$self->do_query(q{ALTER TABLE %s DROP COLUMN `%s`}, $table, $field)) {
$log->syslog('err',
'Could not delete field %s from table %s in database %s',
$field, $table, $self->{'db_name'});
Expand Down
4 changes: 1 addition & 3 deletions src/lib/Sympa/DatabaseDriver/Oracle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,7 @@ sub drop_field {
my $table = shift;
my $field = shift;

unless (
$self->do_query(q{ALTER TABLE %s DROP (%s)}, $table, $field)
) {
unless ($self->do_query(q{ALTER TABLE %s DROP (%s)}, $table, $field)) {
$log->syslog('err',
'Could not delete field %s from table %s in database %s',
$field, $table, $self->{'db_name'});
Expand Down
7 changes: 3 additions & 4 deletions src/lib/Sympa/DatabaseDriver/PostgreSQL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2018, 2021, 2023 The Sympa Community. See the
# Copyright 2018, 2021, 2023, 2024 The Sympa Community. See the
# AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
Expand Down Expand Up @@ -385,9 +385,8 @@ sub drop_field {
my $table = shift;
my $field = shift;

unless (
$self->do_query(q{ALTER TABLE %s DROP COLUMN %s}, $table, $field)
) {
unless ($self->do_query(q{ALTER TABLE %s DROP COLUMN %s}, $table, $field))
{
$log->syslog('err',
'Could not delete field %s from table %s in database %s',
$field, $table, $self->{'db_name'});
Expand Down
7 changes: 3 additions & 4 deletions src/lib/Sympa/DatabaseDriver/SQLite.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2018, 2021, 2022, 2023 The Sympa Community. See the
# Copyright 2018, 2021, 2022, 2023, 2024 The Sympa Community. See the
# AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
Expand Down Expand Up @@ -330,9 +330,8 @@ sub drop_field {
return $report;
}

unless (
$self->do_query("ALTER TABLE %s DROP COLUMN %s", $table, $field)
) {
unless ($self->do_query("ALTER TABLE %s DROP COLUMN %s", $table, $field))
{
$log->syslog('err',
'Could not delete field %s from table %s in database %s',
$field, $table, $self->{'db_name'});
Expand Down
8 changes: 5 additions & 3 deletions src/lib/Sympa/Log.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2017, 2021, 2023 The Sympa Community. See the
# Copyright 2017, 2021, 2023, 2024 The Sympa Community. See the
# AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
Expand Down Expand Up @@ -507,7 +507,8 @@ sub get_first_db_log {
if (($select->{'date_from'} // '') =~ /\A$html_date_re\z/) {
my ($yyyy, $mm, $dd) = split /[^\da-z]/i, $select->{'date_from'};

my $date_from = POSIX::mktime(0, 0, -1, $dd + 0, $mm - 1, $yyyy - 1900);
my $date_from =
POSIX::mktime(0, 0, -1, $dd + 0, $mm - 1, $yyyy - 1900);
unless (($select->{'date_to'} // '') =~ /\A$html_date_re\z/) {
my $date_from2 =
POSIX::mktime(0, 0, 25, $dd + 0, $mm - 1, $yyyy - 1900);
Expand All @@ -516,7 +517,8 @@ sub get_first_db_log {
} else {
my ($yyyy, $mm, $dd) = split /[^\da-z]/i, $select->{'date_to'};

my $date_to = POSIX::mktime(0, 0, 25, $dd + 0, $mm - 1, $yyyy - 1900);
my $date_to =
POSIX::mktime(0, 0, 25, $dd + 0, $mm - 1, $yyyy - 1900);
$statement .= sprintf "AND date_logs >= %s AND date_logs <= %s ",
$date_from, $date_to;
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Sympa/Request/Handler/add.pm
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ sub _report_user {

if (exists $request->{reception}) {
$reception = $request->{reception};
}
else {
$reception = $list->get_default_user_options(role => $role)->{reception};
} else {
$reception =
$list->get_default_user_options(role => $role)->{reception};
}

# Notify the new list owner/editor
Expand Down
17 changes: 7 additions & 10 deletions src/lib/Sympa/Request/Handler/del_user.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ sub _twist {
my $self = shift;
my $request = shift;

my $robot_id = $request->{context};
my $email = $request->{email};
my $robot_id = $request->{context};
my $email = $request->{email};
my $last_robot = $request->{last_robot};
my @stash;

Expand All @@ -60,24 +60,21 @@ sub _twist {
$log->syslog('info', 'List %s', $list->{name});
$list->delete_list_member([$email], exclude => 1);
$self->add_stash($request, 'notice', 'now_unsubscribed',
{email => $email, listname => $list->{'name'}});
{email => $email, listname => $list->{'name'}});
}

# Remove from the editors/owners
for my $role (qw/editor owner/) {
for my $list (Sympa::List::get_which($email, $robot_id, $role)) {
$list->delete_list_admin($role, [$email]);
$self->add_stash($request, 'notice', 'removed',
{'email' => $email, 'listname' => $list->get_id});
{'email' => $email, 'listname' => $list->get_id});
}
}

# Update netidmap_table.
unless (
Sympa::Robot::update_email_netidmap_db(
$robot_id, $email, $email
)
) {
unless (Sympa::Robot::update_email_netidmap_db($robot_id, $email, $email))
{
$self->add_stash($request, 'intern');
$log->syslog('err', 'Update failed');
return undef;
Expand All @@ -90,7 +87,7 @@ sub _twist {

$user_object->expire;
$self->add_stash($request, 'notice', 'user_removed',
{'email' => $email, });
{'email' => $email,});
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/lib/Sympa/Request/Handler/info.pm
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# -*- indent-tabs-mode: nil; -*-
# vim:ft=perl:et:sw=4
# $Id$

# Sympa - SYsteme de Multi-Postage Automatique
#
# Copyright (c) 1997, 1998, 1999 Institut Pasteur & Christophe Wolfhugel
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2024 The Sympa Community. See the
# AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -89,7 +91,7 @@ sub _twist {
$data->{'url'} = Sympa::get_url($list, 'info');

# Owners and moderators no longer are saved in the config file.
$data->{owner} = [$list->get_admins('owner')];
$data->{owner} = [$list->get_admins('owner')];
$data->{editor} = [$list->get_admins('editor')];

unless (Sympa::send_file($list, 'info_report', $sender, $data)) {
Expand Down
13 changes: 8 additions & 5 deletions src/lib/Sympa/Scenario.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2017, 2018, 2019, 2020, 2021, 2022 The Sympa Community. See the
# AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
# Copyright 2017, 2018, 2019, 2020, 2021, 2022, 2024 The Sympa Community.
# See the AUTHORS.md file at the top-level directory of this distribution
# and at <https://github.com/sympa-community/sympa.git>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1049,8 +1049,11 @@ sub do_verify_netmask {
}
}
unless (@cidr) {
$log->syslog('err', 'Error rule syntax: failed to parse netmask "%s"',
$args[0] // '');
$log->syslog(
'err',
'Error rule syntax: failed to parse netmask "%s"',
$args[0] // ''
);
die {};
}

Expand Down
Loading

0 comments on commit c6713cb

Please sign in to comment.