Commit 6f39e269 authored by sikeda's avatar sikeda
Browse files

[dev] Use Sympa::get_address() to generate robot addresses (sympa,...

[dev] Use Sympa::get_address() to generate robot addresses (sympa, sympa-request and listmaster).  Internal configuration keys 'sympa' and 'request' are obsoleted.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12846 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 47b2fb1c
......@@ -1153,8 +1153,6 @@ while ($query = new_loop()) {
foreach my $p (
'email',
'host',
'sympa',
'request',
'soap_url',
'wwsympa_url',
'listmaster_email',
......@@ -1207,6 +1205,9 @@ while ($query = new_loop()) {
or $p =~ /\Acolor_/
or $p =~ /_url\z/;
}
# Compat.: deprecated attributes of Robot.
$param->{'conf'}{'sympa'} = Sympa::get_address($robot);
$param->{'conf'}{'request'} = Sympa::get_address($robot, 'owner');
 
foreach my $auth (keys %{$Conf::Conf{'cas_id'}{$robot}}) {
$log->syslog('debug2', 'CAS authentication service %s', $auth);
......@@ -8986,7 +8987,7 @@ sub do_distribute {
my $cmd_message = Sympa::Message->new(
sprintf("\n\n%s\n", join("\n", @mail_command)),
context => $robot,
envelope_sender => Conf::get_robot_conf($robot, 'request'),
envelope_sender => Sympa::get_address($robot, 'owner'),
sender => $param->{'user'}{'email'},
md5_check => 1,
message_id => Sympa::unique_message_id($robot)
......@@ -20264,7 +20265,7 @@ sub do_remind {
my $message = Sympa::Message->new(
sprintf("\n\n%s\n", $mail_command),
context => $robot,
envelope_sender => Conf::get_robot_conf($robot, 'request'),
envelope_sender => Sympa::get_address($robot, 'owner'),
sender => $param->{'user'}{'email'},
md5_check => 1,
message_id => sprintf('<%s@wwsympa>', $time)
......@@ -21541,8 +21542,7 @@ sub do_send_mail {
if Sympa::Tools::Data::smart_eq($list->{'admin'}{'merge_feature'},
'on');
 
$u_message->{envelope_sender} =
Conf::get_robot_conf($robot, 'request');
$u_message->{envelope_sender} = Sympa::get_address($robot, 'owner');
$u_message->{priority} =
Conf::get_robot_conf($robot, 'sympa_priority');
 
......@@ -21797,7 +21797,7 @@ sub do_tag_topic_by_sender {
my $cmd_message = Sympa::Message->new(
sprintf("\n\nQUIET CONFIRM %s\n", $in{'authkey'}),
context => $robot,
envelope_sender => Conf::get_robot_conf($robot, 'request'),
envelope_sender => Sympa::get_address($robot, 'owner'),
sender => $sender,
md5_check => 1,
message_id => sprintf('<%s@wwsympa>', $time)
......
......@@ -2084,9 +2084,11 @@ sub _infer_robot_parameter_values {
unless ($param->{'config_hash'}{'email'}) {
$param->{'config_hash'}{'email'} = $Conf{'email'};
}
# Obsoleted. Use get_address().
$param->{'config_hash'}{'sympa'} =
$param->{'config_hash'}{'email'} . '@'
. $param->{'config_hash'}{'host'};
# Obsoleted. Use get_address('owner').
$param->{'config_hash'}{'request'} =
$param->{'config_hash'}{'email'}
. '-request@'
......
......@@ -417,9 +417,7 @@ sub send_notify_to_listmaster {
}
my @listmasters = Sympa::get_listmasters_email($that);
my $to =
Conf::get_robot_conf($robot_id, 'listmaster_email') . '@'
. Conf::get_robot_conf($robot_id, 'host');
my $to = Sympa::get_address($robot_id, 'listmaster');
if (ref $data ne 'HASH' and ref $data ne 'ARRAY') {
die
......
......@@ -87,8 +87,7 @@ sub store {
return 1;
} else {
# Overwrite envelope sender
$message->{envelope_sender} =
Conf::get_robot_conf($robot_id, 'request');
$message->{envelope_sender} = Sympa::get_address($robot_id, 'owner');
#FIXME: Priority would better to be '0', isn't it?
$message->{priority} =
Conf::get_robot_conf($robot_id, 'sympa_priority');
......
......@@ -463,9 +463,7 @@ sub set_status_family_closed {
my @param = @_; # No longer used.
unless ($self->{'admin'}{'status'} eq 'family_closed') {
my $updater =
Conf::get_robot_conf($self->{'domain'}, 'listmaster_email') . '@'
. Conf::get_robot_conf($self->{'domain'}, 'host');
my $updater = Sympa::get_address($self->{'domain'}, 'listmaster');
unless ($self->close_list($updater, 'family_closed')) {
$log->syslog('err',
......
......@@ -136,12 +136,15 @@ sub new {
}
foreach my $p (
'email', 'gecos', 'host', 'sympa',
'request', 'listmaster', 'wwsympa_url', 'title',
'listmaster_email'
'email', 'gecos', 'host', 'listmaster',
'wwsympa_url', 'title', 'listmaster_email'
) {
$data->{'conf'}{$p} = Conf::get_robot_conf($robot_id, $p);
}
# Compat.: Deprecated attributes of Robot.
$data->{'conf'}{'sympa'} = Sympa::get_address($robot_id);
$data->{'conf'}{'request'} = Sympa::get_address($robot_id, 'owner');
$data->{'conf'}{'version'} = Sympa::Constants::VERSION();
$data->{'sender'} ||= $who;
......
......@@ -1287,8 +1287,6 @@ sub signoff {
->faultdetail("List $listname unknown");
}
my $host = Conf::get_robot_conf($robot, 'host');
if ($listname eq '*') {
my $success;
foreach my $list (Sympa::List::get_which($sender, $robot, 'member')) {
......@@ -1463,7 +1461,7 @@ sub subscribe {
'subrequest',
{ 'who' => $sender,
'keyauth' => $keyauth,
'replyto' => Conf::get_robot_conf($robot, 'sympa'),
'replyto' => Sympa::get_address($robot),
'gecos' => $gecos
}
);
......
......@@ -75,9 +75,7 @@ sub _twist {
my ($list, $recipient, $priority);
if ($function eq 'listmaster') {
$recipient =
$Conf::Conf{'listmaster_email'} . '@'
. Conf::get_robot_conf($robot, 'host');
$recipient = Sympa::get_address($robot, 'listmaster');
$priority = 0;
} else {
$list = $message->{context};
......@@ -170,15 +168,14 @@ sub _twist {
# protected against DMARC if neccessary. The listmaster address
# would be protected, too.
$message->add_header('X-Loop', $recipient);
$message->replace_header('Sender',
Conf::get_robot_conf($robot, 'request'));
$message->replace_header('Sender', Sympa::get_address($robot, 'owner'));
$message->delete_header('Resent-Sender');
if ($function eq 'owner' or $function eq 'editor') {
$message->dmarc_protect if $list;
}
# Overwrite envelope sender. It is REQUIRED for delivery.
$message->{envelope_sender} = Conf::get_robot_conf($robot, 'request');
$message->{envelope_sender} = Sympa::get_address($robot, 'owner');
unless (defined Sympa::Mailer->instance->store($message, \@rcpt)) {
$log->syslog('err', 'Impossible to forward mail for %s function %s',
......
......@@ -229,13 +229,9 @@ sub _twist {
my $list_address;
if ($message->{'listtype'} and $message->{'listtype'} eq 'listmaster') {
$list_address =
Conf::get_robot_conf($robot, 'listmaster_email') . '@'
. Conf::get_robot_conf($robot, 'host');
$list_address = Sympa::get_address($robot, 'listmaster');
} elsif ($message->{'listtype'} and $message->{'listtype'} eq 'sympa') {
$list_address =
Conf::get_robot_conf($robot, 'email') . '@'
. Conf::get_robot_conf($robot, 'host');
$list_address = Sympa::get_address($robot);
} else {
unless (ref $list eq 'Sympa::List') {
$log->syslog('err', 'List %s does not exist', $listname);
......
......@@ -295,7 +295,7 @@ sub _twist {
} elsif ($list) {
$return_path = $list->get_list_address('return_path');
} else {
$return_path = Conf::get_robot_conf($robot, 'request');
$return_path = Sympa::get_address($robot, 'owner');
}
if ($new_message->{shelved}{merge}) {
......@@ -383,7 +383,7 @@ sub _twist {
} elsif ($list) {
$return_path = $list->get_list_address('return_path');
} else {
$return_path = Conf::get_robot_conf($robot, 'request');
$return_path = Sympa::get_address($robot, 'owner');
}
if ($new_message->{shelved}{smime_sign}) {
......
Markdown is supported
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