Commit aea4ca14 authored by sikeda's avatar sikeda
Browse files

[-dev] perltidy'ing.

git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12566 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 88687831
......@@ -583,7 +583,7 @@ sub create_list {
$list->{'admin'}{'creation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'creation'}{'date_epoch'} = time;
$list->{'admin'}{'creation'}{'email'} = $param->{'creation_email'}
$list->{'admin'}{'creation'}{'email'} = $param->{'creation_email'}
|| Sympa::get_address($robot, 'listmaster');
$list->{'admin'}{'status'} = $param->{'status'} || 'open';
$list->{'admin'}{'family_name'} = $family->{'name'};
......@@ -683,7 +683,7 @@ sub update_list {
$list->{'admin'}{'creation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'creation'}{'date_epoch'} = time;
$list->{'admin'}{'creation'}{'email'} = $param->{'creation_email'}
$list->{'admin'}{'creation'}{'email'} = $param->{'creation_email'}
|| Sympa::get_address($robot, 'listmaster');
$list->{'admin'}{'status'} = $param->{'status'} || 'open';
$list->{'admin'}{'family_name'} = $family->{'name'};
......
......@@ -203,8 +203,10 @@ sub help {
$sender, $robot);
}
$log->syslog('info', 'HELP from %s accepted (%.2f seconds)',
$sender, Time::HiRes::time() - $time_command);
$log->syslog(
'info', 'HELP from %s accepted (%.2f seconds)',
$sender, Time::HiRes::time() - $time_command
);
return 1;
}
......@@ -279,8 +281,10 @@ sub lists {
$sender, $robot);
}
$log->syslog('info', 'LISTS from %s accepted (%.2f seconds)',
$sender, Time::HiRes::time() - $time_command);
$log->syslog(
'info', 'LISTS from %s accepted (%.2f seconds)',
$sender, Time::HiRes::time() - $time_command
);
return 1;
}
......@@ -915,7 +919,8 @@ sub review {
$cmd_line, $sender, $robot);
return undef;
}
$log->syslog('info', 'REVIEW %s from %s, auth requested (%.2f seconds)',
$log->syslog('info',
'REVIEW %s from %s, auth requested (%.2f seconds)',
$listname, $sender, Time::HiRes::time() - $time_command);
return 1;
}
......@@ -1037,9 +1042,12 @@ sub verify {
Sympa::Report::notice_report_cmd('dkim', {}, $cmd_line);
}
} else {
$log->syslog('info',
$log->syslog(
'info',
'VERIFY from %s: could not find correct S/MIME signature (%.2f seconds)',
$sender, Time::HiRes::time() - $time_command);
$sender,
Time::HiRes::time() - $time_command
);
Sympa::Report::reject_report_cmd('user', 'no_verify_sign', {},
$cmd_line);
}
......@@ -1302,8 +1310,11 @@ sub subscribe {
);
}
$log->syslog(
'info', 'SUB %s from %s accepted (%.2f seconds, %d subscribers)',
$which, $sender, Time::HiRes::time() - $time_command,
'info',
'SUB %s from %s accepted (%.2f seconds, %d subscribers)',
$which,
$sender,
Time::HiRes::time() - $time_command,
$list->get_total()
);
......@@ -1722,8 +1733,11 @@ sub signoff {
}
$log->syslog(
'info', 'SIG %s from %s accepted (%.2f seconds, %d subscribers)',
$which, $email, Time::HiRes::time() - $time_command,
'info',
'SIG %s from %s accepted (%.2f seconds, %d subscribers)',
$which,
$email,
Time::HiRes::time() - $time_command,
$list->get_total()
);
......@@ -2044,7 +2058,8 @@ sub invite {
return undef;
}
$log->syslog('info', 'INVITE %s from %s, auth requested (%.2f seconds)',
$log->syslog('info',
'INVITE %s from %s, auth requested (%.2f seconds)',
$which, $sender, Time::HiRes::time() - $time_command);
return 1;
}
......@@ -2340,7 +2355,8 @@ sub remind {
return undef;
}
}
$log->syslog('info', 'REMIND %s from %s, auth requested (%.2f seconds)',
$log->syslog('info',
'REMIND %s from %s, auth requested (%.2f seconds)',
$listname, $sender, Time::HiRes::time() - $time_command);
return 1;
} elsif ($action =~ /do_it/i) {
......@@ -2601,7 +2617,8 @@ sub del {
$cmd_line, $sender, $robot);
return undef;
}
$log->syslog('info', 'DEL %s %s from %s, auth requested (%.2f seconds)',
$log->syslog('info',
'DEL %s %s from %s, auth requested (%.2f seconds)',
$which, $who, $sender, Time::HiRes::time() - $time_command);
return 1;
}
......@@ -2905,10 +2922,13 @@ sub distribute {
}
my $spindle = Sympa::Spindle::ProcessModeration->new(
distributed_by => $sender, context => $robot, authkey => $key,
quiet => $quiet);
distributed_by => $sender,
context => $robot,
authkey => $key,
quiet => $quiet
);
unless ($spindle->spin) { # No message.
unless ($spindle->spin) { # No message.
$log->syslog('err',
'Unable to find message with key <%s> for list %s',
$key, $list);
......@@ -2917,8 +2937,10 @@ sub distribute {
$robot, '', $list);
return 'msg_not_found';
} elsif ($spindle->{finish} and $spindle->{finish} eq 'success') {
$log->syslog('info', 'DISTRIBUTE %s %s from %s accepted (%.2f seconds)',
$list->{'name'}, $key, $sender, Time::HiRes::time() - $time_command);
$log->syslog('info',
'DISTRIBUTE %s %s from %s accepted (%.2f seconds)',
$list->{'name'}, $key, $sender,
Time::HiRes::time() - $time_command);
return 1;
} else {
return undef;
......@@ -2954,10 +2976,13 @@ sub confirm {
}
my $spindle = Sympa::Spindle::ProcessHeld->new(
confirmed_by => $sender, context => $robot, authkey => $key,
quiet => $quiet);
confirmed_by => $sender,
context => $robot,
authkey => $key,
quiet => $quiet
);
unless ($spindle->spin) { # No message.
unless ($spindle->spin) { # No message.
$log->syslog('info', 'CONFIRM %s from %s refused, auth failed',
$key, $sender);
Sympa::Report::reject_report_msg('user', 'unfound_file_message',
......@@ -2965,8 +2990,7 @@ sub confirm {
$robot, '', '');
return 'wrong_auth';
} elsif ($spindle->{finish} and $spindle->{finish} eq 'success') {
$log->syslog('info',
'CONFIRM %s from %s accepted (%.2f seconds)',
$log->syslog('info', 'CONFIRM %s from %s accepted (%.2f seconds)',
$key, $sender, Time::HiRes::time() - $time_command);
return 1;
} else {
......@@ -3017,10 +3041,13 @@ sub reject {
}
my $spindle = Sympa::Spindle::ProcessModeration->new(
rejected_by => $sender, context => $list, authkey => $key,
quiet => $quiet);
rejected_by => $sender,
context => $list,
authkey => $key,
quiet => $quiet
);
unless ($spindle->spin) { # No message
unless ($spindle->spin) { # No message
$log->syslog('info', 'REJECT %s %s from %s refused, auth failed',
$which, $key, $sender);
Sympa::Report::reject_report_msg('user', 'unfound_message', $sender,
......@@ -3029,7 +3056,8 @@ sub reject {
return 'wrong_auth';
} elsif ($spindle->{finish} and $spindle->{finish} eq 'success') {
$log->syslog('info', 'REJECT %s %s from %s accepted (%.2f seconds)',
$list->{'name'}, $key, $sender, Time::HiRes::time() - $time_command);
$list->{'name'}, $key, $sender,
Time::HiRes::time() - $time_command);
return 1;
} else {
return undef;
......@@ -3211,8 +3239,10 @@ sub which {
$cmd_line, $sender, $robot);
}
$log->syslog('info', 'WHICH from %s accepted (%.2f seconds)',
$sender, Time::HiRes::time() - $time_command);
$log->syslog(
'info', 'WHICH from %s accepted (%.2f seconds)',
$sender, Time::HiRes::time() - $time_command
);
return 1;
}
......
......@@ -9636,7 +9636,7 @@ Return the list email address of type TYPE: posting address (default),
# OBSOLETED. Merged into Sympa::get_address().
sub get_list_address {
goto &Sympa::get_address; # "&" is required.
goto &Sympa::get_address; # "&" is required.
}
=over 4
......
......@@ -2935,7 +2935,7 @@ sub check_virus_infection {
}
# if debug mode is active, the working directory is kept
unless ($options{debug}) { #FIXME: Is this condition required?
unless ($options{debug}) { #FIXME: Is this condition required?
opendir DIR, $work_dir;
my @list = readdir DIR;
closedir DIR;
......
......@@ -57,8 +57,9 @@ sub _twist {
};
# List msg topic.
if (not $self->{confirmed_by} # Not in ProcessHeld spindle.
and $list->is_there_msg_topic) {
if (not $self->{confirmed_by} # Not in ProcessHeld spindle.
and $list->is_there_msg_topic
) {
my $topic;
if ($topic = Sympa::Topic->load($message)) {
# Is message already tagged?
......@@ -141,34 +142,34 @@ sub _twist {
}
if ($action =~ /^do_it\b/) {
$self->{quiet} ||= ($action =~ /,\s*quiet\b/); # Overwrite.
unless ($self->{confirmed_by}) { # Not in ProcessHeld spindle.
$message->{shelved}{dkim_sign} = 1
if Sympa::Tools::Data::is_in_array(
$list->{'admin'}{'dkim_signature_apply_on'}, 'any')
or (
Sympa::Tools::Data::is_in_array(
$self->{quiet} ||= ($action =~ /,\s*quiet\b/); # Overwrite.
unless ($self->{confirmed_by}) { # Not in ProcessHeld spindle.
$message->{shelved}{dkim_sign} = 1
if Sympa::Tools::Data::is_in_array(
$list->{'admin'}{'dkim_signature_apply_on'}, 'any')
or (
Sympa::Tools::Data::is_in_array(
$list->{'admin'}{'dkim_signature_apply_on'},
'smime_authenticated_messages')
and $message->{'smime_signed'}
)
or (
Sympa::Tools::Data::is_in_array(
$list->{'admin'}{'dkim_signature_apply_on'},
'dkim_authenticated_messages')
and $message->{'dkim_pass'}
);
} else {
$message->add_header('X-Validation-by', $self->{confirmed_by});
$message->{shelved}{dkim_sign} = 1
if Sympa::Tools::Data::is_in_array(
$list->{'admin'}{'dkim_signature_apply_on'}, 'any')
or Sympa::Tools::Data::is_in_array(
$list->{'admin'}{'dkim_signature_apply_on'},
'smime_authenticated_messages')
and $message->{'smime_signed'}
)
or (
Sympa::Tools::Data::is_in_array(
$list->{'admin'}{'dkim_signature_apply_on'},
'dkim_authenticated_messages')
and $message->{'dkim_pass'}
);
} else {
$message->add_header('X-Validation-by', $self->{confirmed_by});
$message->{shelved}{dkim_sign} = 1
if Sympa::Tools::Data::is_in_array(
$list->{'admin'}{'dkim_signature_apply_on'}, 'any')
or Sympa::Tools::Data::is_in_array(
$list->{'admin'}{'dkim_signature_apply_on'},
'md5_authenticated_messages');
}
'md5_authenticated_messages');
}
# Check TT2 syntax for merge_feature.
unless ($message->test_personalize($list)) {
......@@ -187,8 +188,10 @@ sub _twist {
unless $self->{confirmed_by};
return ['Sympa::Spindle::DistributeMessage'];
} elsif (not $self->{confirmed_by} # Not in ProcessHeld spindle.
and $action =~ /^request_auth\b/) {
} elsif (
not $self->{confirmed_by} # Not in ProcessHeld spindle.
and $action =~ /^request_auth\b/
) {
## Check syntax for merge_feature.
unless ($message->test_personalize($list)) {
$log->syslog(
......@@ -203,7 +206,7 @@ sub _twist {
return ['Sympa::Spindle::ToHeld'];
} elsif ($action =~ /^editorkey\b/) {
$self->{quiet} ||= ($action =~ /,\s*quiet\b/); # Overwrite
$self->{quiet} ||= ($action =~ /,\s*quiet\b/); # Overwrite
# Check syntax for merge_feature.
unless ($message->test_personalize($list)) {
......@@ -219,7 +222,7 @@ sub _twist {
return ['Sympa::Spindle::ToModeration'];
} elsif ($action =~ /^editor\b/) {
$self->{quiet} ||= ($action =~ /,\s*quiet\b/); # Overwrite
$self->{quiet} ||= ($action =~ /,\s*quiet\b/); # Overwrite
# Check syntax for merge_feature.
unless ($message->test_personalize($list)) {
......
......@@ -63,63 +63,61 @@ sub _twist {
my $list = $message->{context};
my $messageid = $message->{message_id};
my $sender =
$self->{confirmed_by} || $self->{distributed_by} || $message->{sender};
my $numsmtp = _distribute_msg($message);
unless (defined $numsmtp) {
$log->syslog('err', 'Unable to send message %s to list %s',
$message, $list);
$self->{confirmed_by}
|| $self->{distributed_by}
|| $message->{sender};
my $numsmtp = _distribute_msg($message);
unless (defined $numsmtp) {
$log->syslog('err', 'Unable to send message %s to list %s',
$message, $list);
Sympa::send_notify_to_listmaster(
$list,
'mail_intern_error',
{ error => '',
{ error => '',
who => $sender,
msg_id => $messageid,
}
);
Sympa::send_dsn($list, $message, {}, '5.3.0');
$log->db_log(
'robot' => $list->{'domain'},
'list' => $list->{'name'},
'action' => 'DoMessage',
'parameters' => $message->get_id,
'target_email' => '',
'msg_id' => $messageid,
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender
'robot' => $list->{'domain'},
'list' => $list->{'name'},
'action' => 'DoMessage',
'parameters' => $message->get_id,
'target_email' => '',
'msg_id' => $messageid,
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender
);
return undef;
} elsif (not $self->{quiet}) {
if ($self->{confirmed_by}) {
Sympa::Report::notice_report_msg(
'message_confirmed', $sender,
{'key' => $self->{authkey}, 'message' => $message}, $list->{'domain'},
$list
);
Sympa::Report::notice_report_msg('message_confirmed', $sender,
{'key' => $self->{authkey}, 'message' => $message},
$list->{'domain'}, $list);
} elsif ($self->{distributed_by}) {
Sympa::Report::notice_report_msg(
'message_distributed', $sender,
{'key' => $self->{authkey}, 'message' => $message}, $list->{'domain'},
$list
);
Sympa::Report::notice_report_msg('message_distributed', $sender,
{'key' => $self->{authkey}, 'message' => $message},
$list->{'domain'}, $list);
}
}
$log->syslog(
'info',
'Message %s for %s from %s accepted (%.2f seconds, %d sessions, %d subscribers), message ID=%s, size=%d',
$message,
$list,
$sender,
Time::HiRes::time() - $self->{start_time},
$numsmtp,
$list->get_total,
$messageid,
$message->{'size'}
);
return 1;
$log->syslog(
'info',
'Message %s for %s from %s accepted (%.2f seconds, %d sessions, %d subscribers), message ID=%s, size=%d',
$message,
$list,
$sender,
Time::HiRes::time() - $self->{start_time},
$numsmtp,
$list->get_total,
$messageid,
$message->{'size'}
);
return 1;
}
# Private subroutines.
......
......@@ -53,7 +53,7 @@ sub _init {
}
sub _on_garbage {
my $self = shift;
my $self = shift;
my $handle = shift;
# Keep broken message and skip it.
......
......@@ -46,15 +46,15 @@ sub _init {
if ($state == 0) {
die 'bug in logic. Ask developer'
unless ($self->{distributed_by} or $self->{rejected_by})
and $self->{context}
and $self->{authkey};
and $self->{context}
and $self->{authkey};
}
1;
}
sub _on_garbage {
my $self = shift;
my $self = shift;
my $handle = shift;
# Keep broken message and skip it.
......@@ -97,7 +97,7 @@ sub _twist {
# Private subroutines.
sub _reject {
my $self = shift;
my $self = shift;
my $message = shift;
# Messages marked validated should not be rejected.
......@@ -131,7 +131,9 @@ sub _reject {
# Notify author of message.
unless ($self->{quiet}) {
unless (Sympa::send_file($list, 'reject', $message->{sender}, $param)) {
unless (
Sympa::send_file($list, 'reject', $message->{sender}, $param))
{
$log->syslog('notice',
'Unable to send template "reject" to %s',
$message->{sender});
......@@ -140,11 +142,10 @@ sub _reject {
}
# Notify list moderator
Sympa::Report::notice_report_msg(
'message_rejected', $self->{rejected_by},
{'key' => $message->{authkey}, 'message' => $message}, $list->{'domain'},
$list
);
Sympa::Report::notice_report_msg('message_rejected',
$self->{rejected_by},
{'key' => $message->{authkey}, 'message' => $message},
$list->{'domain'}, $list);
}
1;
......
......@@ -68,8 +68,10 @@ sub _twist {
$log->syslog('info', 'Sending digest to list %s', $list);
$self->_distribute_digest($spool_digest);
$log->syslog('info', 'Digest of the list %s sent (%.2f seconds)',
$list, Time::HiRes::time() - $self->{start_time});
$log->syslog(
'info', 'Digest of the list %s sent (%.2f seconds)',
$list, Time::HiRes::time() - $self->{start_time}
);
$log->db_log(
'robot' => $list->{'domain'},
'list' => $list->{'name'},
......
......@@ -41,51 +41,61 @@ sub _twist {
my $self = shift;
my $message = shift;
my $list = $message->{context};
my $list = $message->{context};
my $messageid = $message->{message_id};
my $sender = $self->{confirmed_by} || $self->{distributed_by} || $message->{sender};
unless (_send_confirm_to_editor($message, 'smtp')) {
$log->syslog(
'err',
'Failed to send moderation request of %s from %s for list %s to editor(s)',
$message,
$sender,
$list
);
my $sender =
$self->{confirmed_by}
|| $self->{distributed_by}
|| $message->{sender};
unless (_send_confirm_to_editor($message, 'smtp')) {
$log->syslog(
'err',
'Failed to send moderation request of %s from %s for list %s to editor(s)',
$message,
$sender,
$list
);
Sympa::send_notify_to_listmaster(
$list,
'mail_intern_error',
{ error => 'The request moderation sending to moderator failed.',
{ error =>
'The request moderation sending to moderator failed.',
who => $sender,
msg_id => $messageid,
}
);
Sympa::send_dsn($list, $message, {}, '5.3.0');
$log->db_log(
'robot' => $list->{'domain'},
'list' => $list->{'name'},
'action' => 'DoMessage',
'parameters' => $message->get_id,
'target_email' => '',
'msg_id' => $messageid,
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender
);
return undef;
}
$log->syslog('info', 'Message %s for list %s from %s sent to editors (%.2f seconds)',
$message, $list, $sender, Time::HiRes::time() - $self->{start_time});
$log->db_log(
'robot' => $list->{'domain'},
'list' => $list->{'name'},
'action' => 'DoMessage',
'parameters' => $message->get_id,
'target_email' => '',
'msg_id' => $messageid,
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender
);
return undef;
}
# Do not report to the sender if the message was tagged as a spam.
unless ($self->{quiet} or $message->{'spam_status'} eq 'spam') {
Sympa::Report::notice_report_msg('moderating_message', $sender,
{'message' => $message},
$list->{'domain'}, $list);
}
return 1;
$log->syslog(
'info',
'Message %s for list %s from %s sent to editors (%.2f seconds)',
$message,