Commit 5dbd3c7a authored by sikeda's avatar sikeda
Browse files

[-dev] Perltidy'ing.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12654 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 5ebbe536
......@@ -417,27 +417,27 @@ our %action_args = (
'get_inactive_lists' => [],
'get_biggest_lists' => [],
'search_list' => ['filter_list'],
'shared' => ['list', '@path'], #FIXME: no such function.
'd_read' => ['list', '@path'],
'latest_d_read' => ['list'],
'd_admin' => ['list', 'd_admin'],
'd_delete' => ['list', '@path'],
'd_rename' => ['list', '@path'],
'd_create_dir' => ['list', '@path'],
'd_overwrite' => ['list', '@path'],
'd_savefile' => ['list', '@path'],
'd_describe' => ['list', '@path'],
'd_editfile' => ['list', '@path'],
'd_properties' => ['list', '@path'],
'd_control' => ['list', '@path'],
'd_change_access' => ['list', '@path'],
'd_set_owner' => ['list', '@path'],
'dump' => ['list', 'format'],
'search' => ['list', 'filter'],
'search_user' => ['email'],
'set_lang' => ['lang'],
'attach' => ['list', 'dir', 'file'],
'stats' => ['list'],
'shared' => ['list', '@path'], #FIXME: no such function.
'd_read' => ['list', '@path'],
'latest_d_read' => ['list'],
'd_admin' => ['list', 'd_admin'],
'd_delete' => ['list', '@path'],
'd_rename' => ['list', '@path'],
'd_create_dir' => ['list', '@path'],
'd_overwrite' => ['list', '@path'],
'd_savefile' => ['list', '@path'],
'd_describe' => ['list', '@path'],
'd_editfile' => ['list', '@path'],
'd_properties' => ['list', '@path'],
'd_control' => ['list', '@path'],
'd_change_access' => ['list', '@path'],
'd_set_owner' => ['list', '@path'],
'dump' => ['list', 'format'],
'search' => ['list', 'filter'],
'search_user' => ['email'],
'set_lang' => ['lang'],
'attach' => ['list', 'dir', 'file'],
'stats' => ['list'],
'edit_list_request' => ['list', 'group'],
'rename_list' => ['list', 'new_list', 'new_robot'],
'copy_list' => ['list', 'new_list', 'new_robot'],
......@@ -588,14 +588,14 @@ our %required_args = (
'set' => ['param.list', 'reception|visibility'],
'set_lang' => [],
'set_pending_list_request' => ['param.user.email'],
'setpasswd' => ['param.user.email', 'newpasswd1', 'newpasswd2'],
'setpref' => ['param.user.email'],
'sigindex' => ['param.list', 'param.user.email'],
'signoff' => ['param.list'],
'sigrequest' => ['param.list'],
'skinsedit' => ['param.user.email'],
'sso_login' => ['auth_service_name'],
'stats' => ['param.list'],
'setpasswd' => ['param.user.email', 'newpasswd1', 'newpasswd2'],
'setpref' => ['param.user.email'],
'sigindex' => ['param.list', 'param.user.email'],
'signoff' => ['param.list'],
'sigrequest' => ['param.list'],
'skinsedit' => ['param.user.email'],
'sso_login' => ['auth_service_name'],
'stats' => ['param.list'],
'subindex' => ['param.list', 'param.user.email'],
'suboptions' => ['param.list', 'param.user.email'],
'subrequest' => ['param.list'],
......@@ -6142,7 +6142,11 @@ sub do_subscribe {
Sympa::Report::reject_report_web(
'user',
'max_list_members_exceeded',
{max_list_members => $list->{'admin'}{'max_list_members'}, list => $list->{'name'}, 'sub' => $param->{'user'}{'email'}},
{ max_list_members =>
$list->{'admin'}{'max_list_members'},
list => $list->{'name'},
'sub' => $param->{'user'}{'email'}
},
$param->{'action'},
$list,
$param->{'user'}{'email'},
......@@ -8150,10 +8154,18 @@ sub do_add {
if (defined $list->{'add_outcome'}{'errors'}) {
if (defined $list->{'add_outcome'}{'errors'}
{'max_list_members_exceeded'}) {
Sympa::Report::reject_report_web('user',
Sympa::Report::reject_report_web(
'user',
'max_list_members_exceeded',
{max_list_members => $list->{'admin'}{'max_list_members'}, list => $list->{'name'}, 'sub' => $param->{'user'}{'email'}},
$param->{'action'}, $list, $param->{'user'}{'email'}, $robot);
{ max_list_members => $list->{'admin'}{'max_list_members'},
list => $list->{'name'},
'sub' => $param->{'user'}{'email'}
},
$param->{'action'},
$list,
$param->{'user'}{'email'},
$robot
);
} else {
my $error = $language->gettext_sprintf(
"Unable to add users in list %s : %s",
......@@ -8288,22 +8300,34 @@ sub do_add_fromsub {
);
if ($list->{'add_outcome'}{'errors'}{'max_list_members_exceeded'})
{
Sympa::Report::reject_report_web('user',
Sympa::Report::reject_report_web(
'user',
'max_list_members_exceeded',
{max_list_members => $list->{'admin'}{'max_list_members'}, list => $list->{'name'}, sub => $param->{'user'}{'email'}},
$param->{'action'}, $list, $param->{'user'}{'email'},
$robot);
{ max_list_members =>
$list->{'admin'}{'max_list_members'},
list => $list->{'name'},
sub => $param->{'user'}{'email'}
},
$param->{'action'},
$list,
$param->{'user'}{'email'},
$robot
);
last;
} else {
my $error = $language->gettext_sprintf(
"Unable to add users in list %s : %s",
$list->{'name'},
$list->{'add_outcome'}{'errors'}{'error_message'});
Sympa::Report::reject_report_web('intern',
Sympa::Report::reject_report_web(
'intern',
$error,
{sub => $param->{'user'}{'email'}},
$param->{'action'}, $list, $param->{'user'}{'email'},
$robot);
$param->{'action'},
$list,
$param->{'user'}{'email'},
$robot
);
}
} else {
# Delete subscription request.
......
......@@ -287,8 +287,10 @@ sub request_auth {
} else {
if ($cmd eq 'global_remind') {
my $keyauth =
Sympa::compute_auth(context => '*', action => 'global_remind');
my $keyauth = Sympa::compute_auth(
context => '*',
action => 'global_remind'
);
$data->{'command'} = "auth $keyauth remind *";
$data->{'command_escaped'} =
tools::escape_url($data->{'command'});
......
......@@ -33,12 +33,11 @@ use Sympa::Regexps;
my $_email_re = Sympa::Regexps::addrspec();
our %comms = (
add => {
cmd_regexp => qr'add'i,
arg_regexp => qr{(\S+)\s+($_email_re)(?:\s+(.+))?\s*\z},
arg_keys => [qw(localpart email gecos)],
scenario => 'add',
action_regexp =>
qr'reject|request_auth|do_it'i,
cmd_regexp => qr'add'i,
arg_regexp => qr{(\S+)\s+($_email_re)(?:\s+(.+))?\s*\z},
arg_keys => [qw(localpart email gecos)],
scenario => 'add',
action_regexp => qr'reject|request_auth|do_it'i,
},
confirm => {
cmd_regexp => qr'con|confirm'i,
......@@ -46,12 +45,11 @@ our %comms = (
arg_keys => [qw(authkey)],
},
del => {
cmd_regexp => qr'del|delete'i,
arg_regexp => qr{(\S+)\s+($_email_re)\s*},
arg_keys => [qw(localpart email)],
scenario => 'del',
action_regexp =>
qr'reject|request_auth|do_it'i,
cmd_regexp => qr'del|delete'i,
arg_regexp => qr{(\S+)\s+($_email_re)\s*},
arg_keys => [qw(localpart email)],
scenario => 'del',
action_regexp => qr'reject|request_auth|do_it'i,
},
distribute => {
cmd_regexp => qr'dis|distribute'i,
......@@ -60,45 +58,40 @@ our %comms = (
# No scenario.
},
get => {
cmd_regexp => qr'get'i,
arg_regexp => qr'(\S+)\s+(.+)',
arg_keys => [qw(localpart arc)],
scenario => 'archive.mail_access',
action_regexp =>
qr'reject|do_it'i,
cmd_regexp => qr'get'i,
arg_regexp => qr'(\S+)\s+(.+)',
arg_keys => [qw(localpart arc)],
scenario => 'archive.mail_access',
action_regexp => qr'reject|do_it'i,
},
help => {cmd_regexp => qr'hel|help|sos'i,},
info => {
cmd_regexp => qr'inf|info'i,
arg_regexp => qr'(.+)',
arg_keys => [qw(localpart)],
scenario => 'info',
action_regexp =>
qr'reject|do_it'i,
cmd_regexp => qr'inf|info'i,
arg_regexp => qr'(.+)',
arg_keys => [qw(localpart)],
scenario => 'info',
action_regexp => qr'reject|do_it'i,
},
index => {
cmd_regexp => qr'ind|index'i,
arg_regexp => qr'(.+)',
arg_keys => [qw(localpart)],
scenario => 'archive.mail_access',
action_regexp =>
qr'reject|do_it'i,
cmd_regexp => qr'ind|index'i,
arg_regexp => qr'(.+)',
arg_keys => [qw(localpart)],
scenario => 'archive.mail_access',
action_regexp => qr'reject|do_it'i,
},
invite => {
cmd_regexp => qr'inv|invite'i,
arg_regexp => qr{(\S+)\s+($_email_re)(?:\s+(.+))?\s*\z},
arg_keys => [qw(localpart email gecos)],
scenario => 'invite',
action_regexp =>
qr'reject|request_auth|do_it'i,
cmd_regexp => qr'inv|invite'i,
arg_regexp => qr{(\S+)\s+($_email_re)(?:\s+(.+))?\s*\z},
arg_keys => [qw(localpart email gecos)],
scenario => 'invite',
action_regexp => qr'reject|request_auth|do_it'i,
},
last => {
cmd_regexp => qr'las|last'i,
arg_regexp => qr'(.+)',
arg_keys => [qw(localpart)],
scenario => 'archive.mail_access',
action_regexp =>
qr'reject|do_it'i,
cmd_regexp => qr'las|last'i,
arg_regexp => qr'(.+)',
arg_keys => [qw(localpart)],
scenario => 'archive.mail_access',
action_regexp => qr'reject|do_it'i,
},
lists => {cmd_regexp => qr'lis|lists?'i,},
modindex => {
......@@ -132,23 +125,20 @@ our %comms = (
}
$r;
},
scenario => 'remind',
action_regexp =>
qr'reject|request_auth|do_it'i,
scenario => 'remind',
action_regexp => qr'reject|request_auth|do_it'i,
},
global_remind => {
cmd_regexp => qr'(?:rem|remind)\s+[*]'i,
scenario => 'global_remind',
action_regexp =>
qr'reject|request_auth|do_it'i,
cmd_regexp => qr'(?:rem|remind)\s+[*]'i,
scenario => 'global_remind',
action_regexp => qr'reject|request_auth|do_it'i,
},
review => {
cmd_regexp => qr'rev|review|who'i,
arg_regexp => qr'(.+)',
arg_keys => [qw(localpart)],
scenario => 'review',
action_regexp =>
qr'reject|request_auth|do_it'i,
cmd_regexp => qr'rev|review|who'i,
arg_regexp => qr'(.+)',
arg_keys => [qw(localpart)],
scenario => 'review',
action_regexp => qr'reject|request_auth|do_it'i,
},
set => {
cmd_regexp => qr'set'i,
......@@ -184,12 +174,11 @@ our %comms = (
},
},
stats => {
cmd_regexp => qr'sta|stats'i,
arg_regexp => qr'(.+)',
arg_keys => [qw(localpart)],
scenario => 'review',
action_regexp =>
qr'reject|do_it'i, #FIXME: request_auth?
cmd_regexp => qr'sta|stats'i,
arg_regexp => qr'(.+)',
arg_keys => [qw(localpart)],
scenario => 'review',
action_regexp => qr'reject|do_it'i, #FIXME: request_auth?
},
subscribe => {
cmd_regexp => qr'sub|subscribe'i,
......@@ -200,9 +189,8 @@ our %comms = (
$r->{email} = $r->{sender};
$r;
},
scenario => 'subscribe',
action_regexp =>
qr'reject|request_auth|owner|do_it'i,
scenario => 'subscribe',
action_regexp => qr'reject|request_auth|owner|do_it'i,
},
signoff => {
cmd_regexp => qr'sig|signoff|uns|unsub|unsubscribe'i,
......@@ -225,9 +213,8 @@ our %comms = (
}
$r;
},
scenario => 'unsubscribe',
action_regexp =>
qr'reject|request_auth|owner|do_it'i,
scenario => 'unsubscribe',
action_regexp => qr'reject|request_auth|owner|do_it'i,
},
global_signoff => {
cmd_regexp => qr'(?:sig|signoff|uns|unsub|unsubscribe)\s+[*]'i,
......
......@@ -45,7 +45,7 @@ sub new {
}
sub next {
my $self = shift;
my $self = shift;
unless ($self->{_metadatas}) {
$self->{_metadatas} = $self->_load;
......@@ -95,9 +95,9 @@ sub _load {
action => $action,
cmd_line =>
sprintf('%s %s', $message->{listtype}, $list->{'name'}),
context => $list,
email => $message->{sender},
message => $message,
context => $list,
email => $message->{sender},
message => $message,
#FIXME: smime_signed?
(map { $_ => $message->{$_} } qw(sender dkim_pass)),
)
......@@ -149,9 +149,9 @@ sub _load {
# Old name: Sympa::Commands::parse().
sub _parse {
$log->syslog('debug2', '(%s, %s, %s, %s)', @_);
my $robot = shift;
my $line = shift;
my $message = shift;
my $robot = shift;
my $line = shift;
my $message = shift;
$log->syslog('notice', "Parsing: %s", $line);
......@@ -162,10 +162,10 @@ sub _parse {
my $l = $line;
foreach my $action (
sort(grep /global_/, keys %Sympa::CommandDef::comms),
sort(grep /global_/, keys %Sympa::CommandDef::comms),
sort(grep !/global_/, keys %Sympa::CommandDef::comms)
) {
my $comm = $Sympa::CommandDef::comms{$action};
my $comm = $Sympa::CommandDef::comms{$action};
my $cmd_regexp = $comm->{cmd_regexp};
my $arg_regexp = $comm->{arg_regexp};
my $arg_keys = $comm->{arg_keys};
......@@ -208,8 +208,9 @@ sub _parse {
error => 'syntax_error',
message => $message,
quiet => $quiet,
(map { $_ => $message->{$_} }
qw(sender dkim_pass smime_signed)),
( map { $_ => $message->{$_} }
qw(sender dkim_pass smime_signed)
),
);
}
......@@ -248,7 +249,7 @@ use constant quarantine => 1;
use constant remove => 1;
sub store {
my $self = shift;
my $self = shift;
my $request = shift;
$self->{_metadatas} ||= [];
......
......@@ -37,7 +37,7 @@ use Sympa::Spool::Request;
use base qw(Sympa::Spindle);
my $log = Sympa::Log->instance;
my $log = Sympa::Log->instance;
sub _twist {
my $self = shift;
......@@ -173,8 +173,8 @@ sub _get_auth_method {
my $self = shift;
my $request = shift;
my $that = $request->{context};
my $sender = $request->{sender};
my $that = $request->{context};
my $sender = $request->{sender};
my $cmd = $request->{action};
my $email = $request->{email};
......@@ -205,8 +205,8 @@ sub _get_auth_method {
} else {
$log->syslog('debug2', 'Auth should be %s', $compute);
if (grep { $cmd eq $_ } qw(add del invite signoff subscribe)) {
$self->add_stash($request, 'user',
'wrong_email_confirm', {command => $cmd});
$self->add_stash($request, 'user', 'wrong_email_confirm',
{command => $cmd});
} else {
Sympa::send_notify_to_listmaster(
$that,
......
This diff is collapsed.
......@@ -201,7 +201,7 @@ sub _send_report {
my %data = %{$params || {}};
$data{type} = $type;
$data{cmd} = $request->{cmd_line};
$data{cmd} = $request->{cmd_line};
$data{email} ||= $request->{email};
$data{entry} = ($type eq 'intern') ? 'intern_error' : ($error || '');
my $that = $request->{context};
......
......@@ -33,7 +33,7 @@ use base qw(Sympa::Spindle);
my $log = Sympa::Log->instance;
use constant _distaff => 'Sympa::Request::Message';
use constant _distaff => 'Sympa::Request::Message';
use constant _on_failure => 1;
use constant _on_garbage => 1;
......
......@@ -141,7 +141,7 @@ sub _reject {
$list,
'message_report',
$self->{rejected_by},
{ type => 'success', # Compat. <=6.2.12.
{ type => 'success', # Compat. <=6.2.12.
entry => 'message_rejected',
auto_submitted => 'auto-replied',
key => $message->{authkey}
......
......@@ -33,40 +33,40 @@ use Sympa::Log;
use base qw(Sympa::Spindle);
my $log = Sympa::Log->instance;
my $log = Sympa::Log->instance;
sub _twist {
my $self = shift;
my $request = shift;
my $sender = $request->{sender};
my $to = $request->{sender_to_confirm} || $sender;
my $to = $request->{sender_to_confirm} || $sender;
$log->syslog('debug2', 'Auth requested from %s', $sender);
unless (Sympa::request_auth(%$request, sender => $to)) {
my $error = sprintf
'Unable to request authentication for command "%s"',
$request->{action};
Sympa::send_notify_to_listmaster(
$request->{context},
'mail_intern_error',
{ error => $error,
who => $sender,
action => 'Command process',
}
);
$self->add_stash($request, 'intern');
return undef;
}
$log->syslog(
'info',
'%s for %s from %s, auth requested (%.2f seconds)',
uc $request->{action},
$log->syslog('debug2', 'Auth requested from %s', $sender);
unless (Sympa::request_auth(%$request, sender => $to)) {
my $error = sprintf
'Unable to request authentication for command "%s"',
$request->{action};
Sympa::send_notify_to_listmaster(
$request->{context},
$sender,
Time::HiRes::time() - $self->{start_time}
'mail_intern_error',
{ error => $error,
who => $sender,
action => 'Command process',
}
);
return 1;
$self->add_stash($request, 'intern');
return undef;
}
$log->syslog(
'info',
'%s for %s from %s, auth requested (%.2f seconds)',
uc $request->{action},
$request->{context},
$sender,
Time::HiRes::time() - $self->{start_time}
);
return 1;
}
1;
......@@ -35,7 +35,7 @@ use Sympa::Spool::Request;
use base qw(Sympa::Spindle);
my $log = Sympa::Log->instance;
my $log = Sympa::Log->instance;
sub _twist {
my $self = shift;
......@@ -45,64 +45,63 @@ sub _twist {
my $message = $request->{message};
my $sender = $request->{sender};
$self->add_stash($request, 'notice', 'req_forward')
unless $request->{quiet};
my $tpl =
{subscribe => 'subrequest', signoff => 'sigrequest'}
->{$request->{action}};
my $owner_action =
{subscribe => 'add', signoff => 'del'}->{$request->{action}};
# Send a notice to the owners.
unless (
$list->send_notify_to_owner(
$tpl,
{ 'who' => $sender,
'keyauth' => Sympa::compute_auth(
context => $list,
email => $request->{email},
action => $owner_action,
),
'replyto' => Sympa::get_address($list, 'sympa'),
'gecos' => $request->{gecos},
}
)
) {
#FIXME: Why is error reported only in this case?
$log->syslog('info',
'Unable to send notify "%s" to %s list owner',
$tpl, $list);
my $error = sprintf 'Unable to send subrequest to %s list owner',
$list->get_id;
Sympa::send_notify_to_listmaster(
$list,
'mail_intern_error',
{ error => $error,
who => $sender,
action => 'Command process',
}
);
$self->add_stash($request, 'intern');
}
my $spool_req = Sympa::Spool::Request->new;
my $add_request = Sympa::Request->new_from_tuples(
%$request,
action => $owner_action,
date => $message->{date}, # Keep date of message.
$self->add_stash($request, 'notice', 'req_forward')
unless $request->{quiet};
my $tpl =
{subscribe => 'subrequest', signoff => 'sigrequest'}
->{$request->{action}};
my $owner_action =
{subscribe => 'add', signoff => 'del'}->{$request->{action}};
# Send a notice to the owners.
unless (
$list->send_notify_to_owner(
$tpl,
{ 'who' => $sender,
'keyauth' => Sympa::compute_auth(
context => $list,
email => $request->{email},
action => $owner_action,
),
'replyto' => Sympa::get_address($list, 'sympa'),