Commit dd5985fd authored by sikeda's avatar sikeda
Browse files

[-dev] Copyedit: Use get_id() and get_address() instead of get_list_id() and...

[-dev] Copyedit: Use get_id() and get_address() instead of get_list_id() and get_list_address() methods of Sympa::List.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12847 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 6f39e269
......@@ -102,7 +102,7 @@ if ($robot) {
$home_sympa = $Conf::Conf{'home'};
}
my $dest_dir =
Conf::get_robot_conf($robot, 'arc_path') . '/' . $list->get_list_id();
Conf::get_robot_conf($robot, 'arc_path') . '/' . $list->get_id;
unless (-d "$home_sympa/$listname") {
die "No directory for list $listname";
......
......@@ -9123,7 +9123,7 @@ sub do_viewmod {
 
my $html_dir =
$Conf::Conf{'viewmail_dir'} . '/mod/'
. $list->get_list_id() . '/'
. $list->get_id . '/'
. $in{'id'};
 
unless (-d $html_dir) {
......@@ -12239,7 +12239,7 @@ sub do_edit_list {
if (exists $changed{'owner'}) {
my @special = ();
push @special,
map { $list->get_list_address($_) }
map { Sympa::get_address($list, $_) }
qw(owner editor return_path subscribe unsubscribe);
push @special, map {
sprintf '%s-%s@%s',
......@@ -13556,7 +13556,7 @@ sub do_close_list {
Sympa::Report::reject_report_web('intern', 'cannot_close_list',
{}, $param->{'action'}, $list, $param->{'user'}{'email'},
$robot);
wwslog('err', 'Cannot close list %s', $list->get_list_id());
wwslog('err', 'Cannot close list %s', $list);
web_db_log(
{ 'status' => 'error',
'error_type' => 'unknown'
......@@ -20338,7 +20338,7 @@ sub do_load_cert {
$ct = 'application/pkix-cert';
}
$param->{'bypass'} = 'extreme';
my $filename = sprintf '%s.cer', $list->get_id();
my $filename = sprintf '%s.cer', $list->get_id;
printf "Content-Disposition: attachment; filename=\"%s\"\n", $filename;
printf "Content-Type: %s\n\n%s", $ct, $cert;
return 1;
......@@ -21184,7 +21184,7 @@ sub do_compose_mail {
$in{'to'} =~ s/ /\@/g;
$param->{'to'} = $in{'to'};
} else {
$param->{'to'} = $list->get_list_address();
$param->{'to'} = Sympa::get_address($list);
}
foreach my $recipient (split(',', $param->{'to'})) {
( $param->{'recipients'}{$recipient}{'local_to'},
......@@ -21263,7 +21263,7 @@ sub do_send_mail {
);
return undef;
}
$to = $list->get_list_address();
$to = Sympa::get_address($list);
}
unless ($param->{'may_post'}) {
Sympa::Report::reject_report_web('auth',
......@@ -21516,17 +21516,18 @@ sub do_send_mail {
# - Message bound for user will be injected into bulk spool.
#FIXME: Check destinations: they should be list, original sender, user or
# other_email.
my @to_list = grep { $_ eq $list->get_list_address } split /\s*,\s*/, $to;
my @to_list =
grep { $_ eq Sympa::get_address($list) } split /\s*,\s*/, $to;
my @to_user =
grep {
$_
and $_ ne $list->get_list_address
and $_ ne Sympa::get_address($list)
and $_ ne $param->{'user'}{'email'}
} split /\s*,\s*/, $to;
my @to_me =
grep {
$_
and $_ ne $list->get_list_address
and $_ ne Sympa::get_address($list)
and $_ eq $param->{'user'}{'email'}
} split /\s*,\s*/, $to;
 
......@@ -21695,7 +21696,7 @@ sub do_request_topic {
}
}
 
$param->{'to'} = $list->get_list_address();
$param->{'to'} = Sympa::get_address($list);
$param->{'authkey'} = $in{'authkey'};
 
my $spool_held =
......
......@@ -916,8 +916,7 @@ sub rename_list {
## Rename archive
my $arc_dir =
Conf::get_robot_conf($robot, 'arc_path') . '/'
. $list->get_list_id();
Conf::get_robot_conf($robot, 'arc_path') . '/' . $list->get_id;
my $new_arc_dir =
Conf::get_robot_conf($param{'new_robot'}, 'arc_path') . '/'
. $param{'new_listname'} . '@'
......
......@@ -2850,7 +2850,7 @@ sub get_next_list_member {
'err',
"Failed to parse custom attributes for user %s, list %s",
$user->{'email'},
$self->get_list_id()
$self
);
}
$user->{'custom_attribute'} = $custom_attr;
......@@ -9457,8 +9457,7 @@ sub get_arc_size {
my $self = shift;
my $dir = shift;
return Sympa::Tools::File::get_dir_size(
$dir . '/' . $self->get_list_id());
return Sympa::Tools::File::get_dir_size($dir . '/' . $self->get_id);
}
# return the date epoch for next delivery planified for a list
......@@ -9655,7 +9654,7 @@ sub purge {
## Remove tasks for this list
Sympa::Task::list_tasks($Conf::Conf{'queuetask'});
foreach my $task (Sympa::Task::get_tasks_by_list($self->get_list_id())) {
foreach my $task (Sympa::Task::get_tasks_by_list($self->get_id)) {
unlink $task->{'filepath'};
}
......@@ -9828,7 +9827,7 @@ sub move_message {
$log->syslog('debug2', '(%s, %s, %s)', $file, $self->{'name'}, $queue);
my $dir = $queue || (Sympa::Constants::SPOOLDIR() . '/distribute');
my $filename = $self->get_list_id() . '.' . time . '.' . int(rand(999));
my $filename = $self->get_id . '.' . time . '.' . (int rand 999);
unless (open OUT, ">$dir/T.$filename") {
$log->syslog('err', 'Cannot create file %s', "$dir/T.$filename");
......
......@@ -3030,10 +3030,10 @@ sub dmarc_protect {
my $newComment;
if ($listtype eq 'owner' or $listtype eq 'editor') {
# -request or -editor address
$anonaddr = $list->get_list_address($listtype);
$anonaddr = Sympa::get_address($list, $listtype);
} else {
$anonaddr = $list->{'admin'}{'dmarc_protection'}{'other_email'};
$anonaddr = $list->get_list_address()
$anonaddr = Sympa::get_address($list)
unless $anonaddr and $anonaddr =~ /\@/;
my @anonFrom = Mail::Address->parse($anonaddr);
if (@anonFrom) {
......
......@@ -170,10 +170,10 @@ sub new {
# . a list should have several certificates and use if possible a
# certificate issued by the same CA as the recipient CA if it exists
if ($smime_sign) {
$data->{'fromlist'} = $list->get_list_address();
$data->{'replyto'} = $list->get_list_address('owner');
$data->{'fromlist'} = Sympa::get_address($list);
$data->{'replyto'} = Sympa::get_address($list, 'owner');
} else {
$data->{'fromlist'} = $list->get_list_address('owner');
$data->{'fromlist'} = Sympa::get_address($list, 'owner');
}
} else {
$data->{'robot_domain'} = Conf::get_robot_conf($robot_id, 'domain');
......
......@@ -349,7 +349,7 @@ sub request_action {
if ($log_it) {
if ($list) {
$trace_scenario = sprintf 'scenario request %s for list %s :',
$operation, $list->get_list_id;
$operation, $list->get_id;
$log->syslog('info', 'Will evaluate scenario %s for list %s',
$operation, $list);
} elsif ($robot_id and $robot_id ne '*') {
......@@ -815,7 +815,7 @@ sub verify {
my $val = $list->{$param};
$value =~ s/\[list\-\>$param\]/$val/;
} elsif ($param eq 'address') {
my $val = $list->get_list_address();
my $val = Sympa::get_address($list);
$value =~ s/\[list\-\>$param\]/$val/;
} else {
my $canon_param = $param;
......
......@@ -93,7 +93,7 @@ sub _twist {
return undef;
}
$recipient = $list->get_list_address($function);
$recipient = Sympa::get_address($list, $function);
$priority = $list->{'admin'}{'priority'};
}
......
......@@ -103,7 +103,7 @@ sub _twist {
}
my $status = system($Conf::Conf{'custom_archiver'},
'--list=' . $list->get_list_id,
'--list=' . $list->get_id,
'--file=' . $Conf::Conf{'tmpdir'} . '/' . $tmpfile,
) >> 8;
unlink $Conf::Conf{'tmpdir'} . '/' . $tmpfile;
......
......@@ -159,8 +159,8 @@ sub _distribute_digest {
}
my $param = {
'replyto' => $list->get_list_address('owner'),
'to' => $list->get_list_address(),
'replyto' => Sympa::get_address($list, 'owner'),
'to' => Sympa::get_address($list),
'boundary1' => '----------=_' . Sympa::unique_message_id($list),
'boundary2' => '----------=_' . Sympa::unique_message_id($list),
};
......
......@@ -250,8 +250,8 @@ sub _twist {
);
return undef;
}
$list_address = $list->get_list_address($message->{listtype})
|| $list->get_list_address;
$list_address = Sympa::get_address($list, $message->{listtype})
|| Sympa::get_address($list);
}
## Loop prevention
......
......@@ -293,7 +293,7 @@ sub _twist {
} elsif ($new_message->{envelope_sender}) {
$return_path = $new_message->{envelope_sender};
} elsif ($list) {
$return_path = $list->get_list_address('return_path');
$return_path = Sympa::get_address($list, 'return_path');
} else {
$return_path = Sympa::get_address($robot, 'owner');
}
......@@ -381,7 +381,7 @@ sub _twist {
if ($new_message->{envelope_sender}) {
$return_path = $new_message->{envelope_sender};
} elsif ($list) {
$return_path = $list->get_list_address('return_path');
$return_path = Sympa::get_address($list, 'return_path');
} else {
$return_path = Sympa::get_address($robot, 'owner');
}
......
......@@ -409,7 +409,7 @@ sub _mail_message {
if $message->{'smime_crypted'};
# Overwrite original envelope sender. It is REQUIRED for delivery.
$message->{envelope_sender} = $list->get_list_address('return_path');
$message->{envelope_sender} = Sympa::get_address($list, 'return_path');
return Sympa::Bulk->new->store($message, $rcpt, tag => $tag)
|| undef;
......
......@@ -27,6 +27,7 @@ package Sympa::Spindle::TransformOutgoing;
use strict;
use warnings;
use Sympa;
use Sympa::Log;
use Sympa::Message::Plugin;
use Sympa::Robot;
......@@ -55,7 +56,7 @@ sub _twist {
$message->delete_header('Resent-Reply-To');
if ($list->{'admin'}{'reply_to_header'}->{'value'} eq 'list') {
$reply = $list->get_list_address();
$reply = Sympa::get_address($list);
} elsif (
$list->{'admin'}{'reply_to_header'}->{'value'} eq 'sender') {
#FIXME: Missing From: field?
......@@ -64,7 +65,7 @@ sub _twist {
{
#FIXME: Missing From: field?
$reply =
$list->get_list_address() . ','
Sympa::get_address($list) . ','
. $message->get_header('From');
} elsif ($list->{'admin'}{'reply_to_header'}->{'value'} eq
'other_email') {
......@@ -78,12 +79,13 @@ sub _twist {
## Add/replace useful header fields
## These fields should be added preserving existing ones.
$message->add_header('X-Loop', $list->get_list_address);
$message->add_header('X-Loop', Sympa::get_address($list));
$message->add_header('X-Sequence', $message->{xsequence})
if defined $message->{xsequence};
## These fields should be overwritten if any of them already exist
$message->delete_header('Errors-To');
$message->add_header('Errors-To', $list->get_list_address('return_path'));
$message->add_header('Errors-To',
Sympa::get_address($list, 'return_path'));
## Two Precedence: fields are added (overwritten), as some MTAs recognize
## only one of them.
$message->delete_header('Precedence');
......@@ -92,7 +94,7 @@ sub _twist {
# The Sender: field should be added (overwritten) at least for DKIM or
# Sender ID (a.k.a. SPF 2.0) compatibility. Note that Resent-Sender:
# field will be removed.
$message->replace_header('Sender', $list->get_list_address('owner'));
$message->replace_header('Sender', Sympa::get_address($list, 'owner'));
$message->delete_header('Resent-Sender');
$message->replace_header('X-no-archive', 'yes');
......
......@@ -33,6 +33,7 @@ use POSIX qw();
use Sys::Hostname qw();
use Time::HiRes qw();
use Sympa;
use Conf;
use Sympa::Constants;
use Sympa::List;
......@@ -264,7 +265,7 @@ sub build_glob_pattern {
my $context = $options{context};
if (ref $context eq 'Sympa::List') {
@options{qw(localpart domainpart)} =
split /\@/, $context->get_list_address;
split /\@/, Sympa::get_address($context);
} else {
$options{domainpart} = $context;
}
......@@ -423,7 +424,7 @@ sub marshal_metadata {
my ($localpart, $domainpart);
if (ref $message->{context} eq 'Sympa::List') {
($localpart) = split /\@/,
$message->{context}->get_list_address($message->{listtype});
Sympa::get_address($message->{context}, $message->{listtype});
$domainpart = $message->{context}->{'domain'};
} else {
my $robot_id = $message->{context} || '*';
......
......@@ -58,7 +58,7 @@ sub get_dkim_parameters {
$list->{'admin'}{'dkim_parameters'}{'signer_identity'};
} else {
# RFC 4871 (page 21)
$data->{'i'} = $list->get_list_address('owner'); # -request
$data->{'i'} = Sympa::get_address($list, 'owner'); # -request
}
$data->{'selector'} = $list->{'admin'}{'dkim_parameters'}{'selector'};
$keyfile = $list->{'admin'}{'dkim_parameters'}{'private_key_path'};
......
......@@ -590,7 +590,7 @@ sub upgrade {
$log->syslog(
'notice',
'Processing list %s...',
$list->get_list_address()
Sympa::get_address($list)
);
## Determine default lang for this list
......@@ -851,7 +851,7 @@ sub upgrade {
$log->syslog(
'notice',
'Processing list %s...',
$list->get_list_address()
Sympa::get_address($list)
);
my @all_files;
......
......@@ -776,7 +776,7 @@ if ($main::options{'dump'}) {
}
printf "Members of list %s have been successfully update.\n",
$list->get_list_address();
Sympa::get_address($list);
exit 0;
## Migration from one version to another
} elsif ($main::options{'upgrade'}) {
......@@ -840,7 +840,7 @@ if ($main::options{'dump'}) {
$log->syslog(
'notice',
'Processing list %s...',
$list->get_list_address()
Sympa::get_address($list)
);
## Determine default lang for this list
......
......@@ -305,9 +305,7 @@ while (!$end) {
my %used_list_models; # stores which models already have a task
foreach (@list_models) { $used_list_models{$_} = undef; }
foreach
my $model (Sympa::Task::get_used_models($list->get_list_id()))
{
foreach my $model (Sympa::Task::get_used_models($list->get_id)) {
$used_list_models{$model} = 1;
}
......
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