Commit 8c0a9a94 authored by sikeda's avatar sikeda
Browse files

[dev] Perltidy-ing.

git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@11276 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 2b001c1b
......@@ -58,8 +58,8 @@ foreach my $msg_file (sort grep(!/^\./, readdir SPOOL)) {
[qw(localpart domainpart modkey)]
);
next unless $metadata;
my $message =
Sympa::Message->new_from_file($modspool . '/' . $msg_file, %$metadata);
my $message = Sympa::Message->new_from_file($modspool . '/' . $msg_file,
%$metadata);
next unless $message;
my $list = $message->{'list'};
......
This diff is collapsed.
......@@ -79,9 +79,7 @@ sub load {
Log::do_log('debug', '(%s)', $id_challenge);
unless ($challenge_id) {
Log::do_log('err',
'Internal error. undefined id_challenge'
);
Log::do_log('err', 'Internal error. undefined id_challenge');
return undef;
}
......
......@@ -862,8 +862,8 @@ sub checkfiles {
## Create directory if required
unless (-d $dir) {
unless (tools::mkdir_all($dir, 0755)) {
Sympa::Robot::send_notify_to_listmaster('cannot_mkdir', $robot,
["Could not create directory $dir: $!"]);
Sympa::Robot::send_notify_to_listmaster('cannot_mkdir',
$robot, ["Could not create directory $dir: $!"]);
Log::do_log('err', 'Failed to create directory %s', $dir);
return undef;
}
......@@ -888,8 +888,9 @@ sub checkfiles {
rename $dir . '/' . $css, $dir . '/' . $css . '.' . time;
unless (open(CSS, ">$dir/$css")) {
Sympa::Robot::send_notify_to_listmaster('cannot_open_file',
$robot, ["Could not open file $dir/$css: $!"]);
Sympa::Robot::send_notify_to_listmaster(
'cannot_open_file', $robot,
["Could not open file $dir/$css: $!"]);
Log::do_log(
'err',
'Failed to open (write) file %s',
......@@ -905,8 +906,8 @@ sub checkfiles {
) {
my $error = tt2::get_error();
$param->{'tt2_error'} = $error;
Sympa::Robot::send_notify_to_listmaster('web_tt2_error', $robot,
[$error]);
Sympa::Robot::send_notify_to_listmaster('web_tt2_error',
$robot, [$error]);
Log::do_log('err', 'Error while installing %s/%s',
$dir, $css);
}
......
......@@ -81,8 +81,8 @@ sub fatal_err {
my $full_msg = sprintf $m, @_;
## Notify listmaster
Sympa::Robot::send_notify_to_listmaster('sympa_died', $Conf::Conf{'domain'},
[$full_msg]);
Sympa::Robot::send_notify_to_listmaster('sympa_died',
$Conf::Conf{'domain'}, [$full_msg]);
printf STDERR "$m\n", @_;
exit(1);
......@@ -203,8 +203,8 @@ sub do_log {
};
if ($@ and $warning_date < time - $warning_timeout) {
$warning_date = time + $warning_timeout;
Sympa::Robot::send_notify_to_listmaster('logs_failed', $Conf::Conf{'domain'},
[$@]);
Sympa::Robot::send_notify_to_listmaster('logs_failed',
$Conf::Conf{'domain'}, [$@]);
}
}
......
......@@ -234,7 +234,9 @@ sub create_list_old {
}
## Check this listname doesn't exist already.
if ($res || Sympa::List->new($param->{'listname'}, $robot, {'just_try' => 1})) {
if ($res
|| Sympa::List->new($param->{'listname'}, $robot, {'just_try' => 1}))
{
Log::do_log('err',
'Could not create already existing list %s on %s for',
$param->{'listname'}, $robot);
......@@ -1634,7 +1636,7 @@ sub change_user_email {
my $datasource = $list->search_datasource($datasource_id);
if ( !defined $datasource
or $datasource->{'type'} ne 'include_list'
or ( $datasource->{'def'} =~ /\@(.+)$/
or ( $datasource->{'def'} =~ /\@(.+)$/
and $1 ne $robot_id)
) {
$use_external_data_sources = 1;
......
......@@ -120,7 +120,8 @@ sub scan_dir_archive {
$dir, $month, $file);
my $message =
Sympa::Message->new_from_file("$dir/$month/arctxt/$file", list => $list);
Sympa::Message->new_from_file("$dir/$month/arctxt/$file",
list => $list);
unless ($message) {
Log::do_log('err', 'Unable to create Message object from file %s',
$file);
......@@ -322,8 +323,11 @@ sub clean_archived_message {
my $input = shift;
my $output = shift;
my $message = Sympa::Message->new_from_file($input,
list => $list, robot => $robot);
my $message = Sympa::Message->new_from_file(
$input,
list => $list,
robot => $robot
);
unless ($message) {
Log::do_log('err', 'Unable to create a Message object with file %s',
$input);
......
This diff is collapsed.
......@@ -597,8 +597,11 @@ sub modify_list {
#getting list
my $list;
unless ($list =
Sympa::List->new($hash_list->{'config'}{'listname'}, $self->{'robot'})) {
unless (
$list = Sympa::List->new(
$hash_list->{'config'}{'listname'}, $self->{'robot'}
)
) {
push @{$return->{'string_error'}},
"The list $hash_list->{'config'}{'listname'} does not exist.";
return $return;
......
......@@ -657,7 +657,8 @@ sub set_status_error_config {
#$self->savestats();
Log::do_log('err', 'The list "%s" is set in status error_config',
$self->{'name'});
Sympa::Robot::send_notify_to_listmaster($message, $self->{'domain'}, \@param);
Sympa::Robot::send_notify_to_listmaster($message, $self->{'domain'},
\@param);
}
}
......@@ -2140,13 +2141,14 @@ sub distribute_digest {
# Commented because one Spam made Sympa die (MIME::tools 5.413)
#$entity->remove_sig;
my $msg = {
'id' => $i,
'subject' => $message->{'decoded_subject'},
'from' => tools::decode_header($message, 'From'),
'date' => tools::decode_header($message, 'Date'),
'full_msg' => $message->as_string,
'body' => $message->body_as_string,
'plain_body' => $message->Sympa::PlainDigest::plain_body_as_string,
'id' => $i,
'subject' => $message->{'decoded_subject'},
'from' => tools::decode_header($message, 'From'),
'date' => tools::decode_header($message, 'Date'),
'full_msg' => $message->as_string,
'body' => $message->body_as_string,
'plain_body' =>
$message->Sympa::PlainDigest::plain_body_as_string,
# Should be extracted from Date:
'month' => POSIX::strftime("%Y-%m", localtime time),
'message_id' => $message->{'message_id'},
......@@ -2431,7 +2433,8 @@ sub _generic_send_file {
if (ref $that eq 'Sympa::List') {
return $that->send_file($tpl, $who, $that->{'domain'}, $param);
} else {
return Sympa::Robot::send_global_file($tpl, $who, $that, $param, $options);
return Sympa::Robot::send_global_file($tpl, $who, $that, $param,
$options);
}
}
......@@ -2615,7 +2618,8 @@ sub send_file {
# to support Sympa server on a machine without any MTA service
$data->{'use_bulk'} = 1
unless ($data->{'alarm'});
unless (Sympa::Mail::mail_file($self->{'domain'}, $filename, $who, $data)) {
unless (Sympa::Mail::mail_file($self->{'domain'}, $filename, $who, $data))
{
Log::do_log('err', 'Could not send template %s to %s',
$filename, $who);
return undef;
......@@ -3374,7 +3378,12 @@ sub request_auth {
}
$data->{'auto_submitted'} = 'auto-replied';
unless (Sympa::Robot::send_global_file('request_auth', $email, $robot, $data)) {
unless (
Sympa::Robot::send_global_file(
'request_auth',
$email, $robot, $data
)
) {
Log::do_log('notice',
'Unable to send template "request_auth" to %s', $email);
return undef;
......@@ -7034,7 +7043,8 @@ sub _include_users_remote_file {
my $total = 0;
my $id = Sympa::Datasource::_get_datasource_id($param);
my $fetch = LWP::UserAgent->new(agent => 'Sympa/' . Sympa::Constants::VERSION);
my $fetch =
LWP::UserAgent->new(agent => 'Sympa/' . Sympa::Constants::VERSION);
my $req = HTTP::Request->new(GET => $url);
if (defined $param->{'user'} && defined $param->{'passwd'}) {
......@@ -8897,8 +8907,8 @@ sub sync_include_admin {
Log::do_log('err',
'Could not get %ss from an include source for list %s',
$role, $name);
Sympa::Robot::send_notify_to_listmaster('sync_include_admin_failed',
$self->{'domain'}, [$name]);
Sympa::Robot::send_notify_to_listmaster(
'sync_include_admin_failed', $self->{'domain'}, [$name]);
return undef;
}
......
......@@ -108,7 +108,11 @@ sub reject_report_msg {
}
} else {
unless (
Sympa::Robot::send_global_file('message_report', $user, $robot, $param)) {
Sympa::Robot::send_global_file(
'message_report',
$user, $robot, $param
)
) {
Log::do_log('notice',
"Sympa::Report::reject_report_msg(): Unable to send template 'message_report' to '$user'"
);
......@@ -124,7 +128,8 @@ sub reject_report_msg {
$param->{'action'} = 'message diffusion';
$param->{'msg_id'} = $param->{'msg_id'};
$param->{'list'} = $list if (defined $list);
Sympa::Robot::send_notify_to_listmaster('mail_intern_error', $robot, $param);
Sympa::Robot::send_notify_to_listmaster('mail_intern_error', $robot,
$param);
}
return 1;
}
......@@ -233,8 +238,11 @@ sub notice_report_msg {
}
} else {
unless (
Sympa::Robot::send_global_file('message_report', $user, $robot, $param))
{
Sympa::Robot::send_global_file(
'message_report',
$user, $robot, $param
)
) {
Log::do_log('notice',
"Sympa::Report::notice_report_msg(): Unable to send template 'message_report' to '$user'"
);
......@@ -357,8 +365,12 @@ sub send_report_cmd {
'globals' => \@global_error_cmd,
};
unless (Sympa::Robot::send_global_file('command_report', $sender, $robot, $data))
{
unless (
Sympa::Robot::send_global_file(
'command_report',
$sender, $robot, $data
)
) {
Log::do_log('notice',
"Sympa::Report::send_report_cmd() : Unable to send template 'command_report' to $sender"
);
......@@ -409,8 +421,8 @@ sub global_report_cmd {
$param->{'who'} = $sender;
$param->{'action'} = 'Command process';
Sympa::Robot::send_notify_to_listmaster('mail_intern_error', $robot,
$param);
Sympa::Robot::send_notify_to_listmaster('mail_intern_error',
$robot, $param);
} else {
Log::do_log('notice',
"Sympa::Report::global_report_cmd(): unable to send notify to listmaster : no robot"
......@@ -493,8 +505,8 @@ sub reject_report_cmd {
$param->{'who'} = $sender;
$param->{'action'} = 'Command process';
Sympa::Robot::send_notify_to_listmaster('mail_intern_error', $robot,
$param);
Sympa::Robot::send_notify_to_listmaster('mail_intern_error',
$robot, $param);
} else {
Log::do_log('notice',
"Sympa::Report::reject_report_cmd(): unable to notify listmaster for error: '$error' : (no robot) "
......
......@@ -157,8 +157,8 @@ sub send_global_file {
return $r if ($options->{'parse_and_return'});
unless ($r) {
Log::do_log('err', 'Could not send template %s to %s', $filename,
$who);
Log::do_log('err', 'Could not send template %s to %s',
$filename, $who);
return undef;
}
......@@ -188,23 +188,22 @@ sub send_notify_to_listmaster {
keys %{$Sympa::Robot::listmaster_messages_stack{$robot}}) {
my $first_age =
time -
$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}
{'first'};
$Sympa::Robot::listmaster_messages_stack{$robot}
{$operation}{'first'};
my $last_age =
time -
$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}
{'last'};
$Sympa::Robot::listmaster_messages_stack{$robot}
{$operation}{'last'};
# not old enough to send and first not too old
next
unless ($purge or ($last_age > 30) or ($first_age > 60));
next
unless (
$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}
{'messages'});
unless ($Sympa::Robot::listmaster_messages_stack{$robot}
{$operation}{'messages'});
my %messages =
%{$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}
{'messages'}};
%{$Sympa::Robot::listmaster_messages_stack{$robot}
{$operation}{'messages'}};
Log::do_log(
'info', 'Got messages about "%s" (%s)',
$operation, join(', ', keys %messages)
......@@ -245,19 +244,23 @@ sub send_notify_to_listmaster {
}
Log::do_log('info', 'Cleaning stacked notifications');
delete $Sympa::Robot::listmaster_messages_stack{$robot}{$operation};
delete $Sympa::Robot::listmaster_messages_stack{$robot}
{$operation};
}
}
return 1;
}
my $stack = 0;
$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}{'first'} = time
unless (
$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}{'first'});
$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}{'first'} =
time
unless ($Sympa::Robot::listmaster_messages_stack{$robot}{$operation}
{'first'});
$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}{'counter'}++;
$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}{'last'} = time;
if ($Sympa::Robot::listmaster_messages_stack{$robot}{$operation}{'counter'} > 3) {
$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}{'last'} =
time;
if ($Sympa::Robot::listmaster_messages_stack{$robot}{$operation}
{'counter'} > 3) {
# stack if too much messages w/ same code
$stack = 1;
}
......@@ -384,7 +387,8 @@ sub send_notify_to_listmaster {
Log::do_log('info', 'Stacking message about "%s" for %s (%s)',
$operation, $ts->{'email'}, $robot)
unless $operation eq 'logs_failed';
push @{$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}
push
@{$Sympa::Robot::listmaster_messages_stack{$robot}{$operation}
{'messages'}{$ts->{'email'}}}, $r;
return 1;
}
......
......@@ -186,8 +186,7 @@ sub login {
}
## Create Sympa::Session object
my $session =
Sympa::Session->new($robot,
my $session = Sympa::Session->new($robot,
{'cookie' => Sympa::Session::encrypt_session_id($ENV{'SESSION_ID'})});
$ENV{'USER_EMAIL'} = $email;
$session->{'email'} = $email;
......@@ -276,8 +275,7 @@ sub casLogin {
}
## Create Sympa::Session object
my $session =
Sympa::Session->new($robot,
my $session = Sympa::Session->new($robot,
{'cookie' => Sympa::Session::encrypt_session_id($ENV{'SESSION_ID'})});
$ENV{'USER_EMAIL'} = $email;
$session->{'email'} = $email;
......@@ -733,8 +731,8 @@ sub closeList {
}
# check authorization
unless (($list->am_i('owner', $sender)) || (Sympa::Robot::is_listmaster($sender)))
{
unless (($list->am_i('owner', $sender))
|| (Sympa::Robot::is_listmaster($sender))) {
Log::do_log('info', 'CloseList %s from %s not allowed',
$listname, $sender);
die SOAP::Fault->faultcode('Client')->faultstring('Not allowed')
......@@ -1721,7 +1719,8 @@ sub get_reason_string {
)
) {
my $error = tt2::get_error();
Sympa::Robot::send_notify_to_listmaster('web_tt2_error', $robot, [$error]);
Sympa::Robot::send_notify_to_listmaster('web_tt2_error', $robot,
[$error]);
Log::do_log('info', 'Error parsing');
return '';
}
......
......@@ -60,8 +60,9 @@ sub request {
if (Sympa::Session::get_session_cookie($ENV{'HTTP_COOKIE'})) {
$session = Sympa::Session->new(
$ENV{'SYMPA_ROBOT'},
{ 'cookie' =>
Sympa::Session::get_session_cookie($ENV{'HTTP_COOKIE'})
{ 'cookie' => Sympa::Session::get_session_cookie(
$ENV{'HTTP_COOKIE'}
)
}
);
} else {
......
......@@ -176,8 +176,8 @@ sub establish_connection {
Log::do_log('err',
"No Database Driver installed for $self->{'db_type'} ; you should download and install DBD::$self->{'db_type'} from CPAN"
);
Sympa::Robot::send_notify_to_listmaster('missing_dbd', $Conf::Conf{'domain'},
{'db_type' => $self->{'db_type'}});
Sympa::Robot::send_notify_to_listmaster('missing_dbd',
$Conf::Conf{'domain'}, {'db_type' => $self->{'db_type'}});
return undef;
}
......
......@@ -444,9 +444,8 @@ sub request_action {
$scenario = Sympa::Scenario->new(
'robot' => $robot_id,
'function' => 'topics_visibility',
'name' =>
$Sympa::Robot::list_of_topics{$robot_id}{$context->{'topicname'}}
{'visibility'},
'name' => $Sympa::Robot::list_of_topics{$robot_id}
{$context->{'topicname'}}{'visibility'},
'options' => $context->{'options'}
);
......@@ -567,8 +566,8 @@ sub request_action {
};
return $return;
}
Sympa::Robot::send_notify_to_listmaster('error-performing-condition',
$robot_id,
Sympa::Robot::send_notify_to_listmaster(
'error-performing-condition', $robot_id,
[$context->{'listname'} . " " . $rule->{'condition'}]);
return undef;
}
......
......@@ -259,7 +259,8 @@ sub upgrade {
);
foreach my $r (keys %{$Conf::Conf{'robots'}}) {
my $all_lists = Sympa::List::get_lists($r, 'skip_sync_admin' => 1);
my $all_lists =
Sympa::List::get_lists($r, 'skip_sync_admin' => 1);
foreach my $list (@$all_lists) {
foreach my $table ('subscriber', 'admin') {
......@@ -907,7 +908,8 @@ sub upgrade {
my $valid_robot = '';
my @valid_robot_candidates;
foreach my $robot (@robots) {
if (my $list = Sympa::List->new($data->{'list_exclusion'}, $robot)) {
if (my $list =
Sympa::List->new($data->{'list_exclusion'}, $robot)) {
if ($list->is_list_member($data->{'user_exclusion'})) {
push @valid_robot_candidates, $robot;
}
......@@ -1264,7 +1266,8 @@ sub upgrade {
next;
}
my $message =
Sympa::Message->new_from_file("$spooldir/$filename", list => $list);
Sympa::Message->new_from_file("$spooldir/$filename",
list => $list);
unless ($message) {
push @ignored, $filename;
next;
......
......@@ -394,7 +394,8 @@ sub load_edit_list_conf {
}
if ($error_in_conf) {
Sympa::Robot::send_notify_to_listmaster('edit_list_error', $robot, [$file]);
Sympa::Robot::send_notify_to_listmaster('edit_list_error', $robot,
[$file]);
}
close FILE;
......@@ -3411,8 +3412,8 @@ sub save_to_bad {
unless (mkdir $queue . '/bad', 0775) {
Log::do_log('notice', 'Unable to create %s/bad/ directory',
$queue);
Sympa::Robot::send_notify_to_listmaster('unable_to_create_dir', $hostname,
{'dir' => "$queue/bad"});
Sympa::Robot::send_notify_to_listmaster('unable_to_create_dir',
$hostname, {'dir' => "$queue/bad"});
return undef;
}
Log::do_log('debug', 'mkdir %s/bad', $queue);
......@@ -4002,7 +4003,8 @@ sub unmarshal_metadata {
($listname, $type) =
tools::split_listname($robot_id || '*', $data->{'localpart'});
if (defined $listname) {
$list = Sympa::List->new($listname, $robot_id || '*', {'just_try' => 1});
$list =
Sympa::List->new($listname, $robot_id || '*', {'just_try' => 1});
}
## Get priority
......
......@@ -208,8 +208,8 @@ sub init_passwd {
$email, {'password' => $passwd}
)
) {
Sympa::Report::reject_report_web('intern', 'update_user_db_failed',
{'user' => $email},
Sympa::Report::reject_report_web('intern',
'update_user_db_failed', {'user' => $email},
'', '', $email, $robot);
Log::do_log('info', 'Update failed');
return undef;
......
......@@ -280,12 +280,12 @@ while (!$end) {
unless ($list->am_i('privileged_owner', $sender)
or $list->am_i('owner', $sender)
or $list->am_i('editor', $sender)
or Sympa::Robot::is_listmaster($sender, $list->{'domain'})) {
or Sympa::Robot::is_listmaster($sender, $list->{'domain'})
) {
# Analyze message to get sender from envelope sender and
# sender_headers.
my $arc_message =
Sympa::Message->new_from_file("$arcpath/arctxt/$arc_file",
list => $list);
my $arc_message = Sympa::Message->new_from_file(
"$arcpath/arctxt/$arc_file", list => $list);
unless ($arc_message) {
Log::do_log('err',
'Unable to load new message %s/arctxt/%s',
......@@ -412,8 +412,8 @@ while (!$end) {
'queue' => $queue,
}
);
Sympa::Robot::send_notify_to_listmaster('archiving_failed', $hostname,
{'file' => "$file", 'bad' => "$queue/bad"});
Sympa::Robot::send_notify_to_listmaster('archiving_failed',
$hostname, {'file' => "$file", 'bad' => "$queue/bad"});
}
if (-f "$queue/$file") {
unless (unlink("$queue/$file")) {
......@@ -869,8 +869,8 @@ sub mail2arc {
if (!-d $basedir) {
unless (mkdir $basedir, 0775) {
Log::do_log('err', 'Cannot create directory %s', $basedir);
Sympa::Robot::send_notify_to_listmaster('unable_to_create_dir',
$robot, {'dir' => "$basedir"});
Sympa::Robot::send_notify_to_listmaster(
'unable_to_create_dir', $robot, {'dir' => "$basedir"});
}
Log::do_log('debug', 'mkdir %s', $basedir);
}
......@@ -967,7 +967,8 @@ sub mail2arc {
# Save arctxt dump of original message.
my $message =
Sympa::Message->new_from_file($queue . '/' . $file, list => $list);
Sympa::Message->new_from_file($queue . '/' . $file,
list => $list);
unless ($message) {
die sprintf 'Couldn\'t open file %s/%s: %s', $queue, $file, $!;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment