Unverified Commit 37932d02 authored by IKEDA Soji's avatar IKEDA Soji Committed by GitHub
Browse files

Merge pull request #1307 from ikedas/issue-1306_wa by ikedas

Improvements on anonymized messages
parents 72290427 d8e1fcae
......@@ -46,6 +46,7 @@ use Sympa::Log;
use Sympa::Regexps;
use Sympa::Spindle::ProcessTemplate;
use Sympa::Tools::Text;
use Sympa::Tools::Time;
my $log = Sympa::Log->instance;
......@@ -763,16 +764,13 @@ sub is_listmaster {
sub unique_message_id {
my $that = shift;
my $domain;
if (ref $that eq 'Sympa::List') {
$domain = Conf::get_robot_conf($that->{'domain'}, 'domain');
} elsif ($that and $that ne '*') {
$domain = Conf::get_robot_conf($that, 'domain');
} else {
$domain = $Conf::Conf{'domain'};
}
return sprintf '<sympa.%d.%d.%d@%s>', time, $PID, (int rand 999), $domain;
my ($time, $usec) = Sympa::Tools::Time::gettimeofday();
my $domain =
(ref $that eq 'Sympa::List') ? $that->{'domain'}
: ($that and $that ne '*') ? $that
: $Conf::Conf{'domain'};
return sprintf '<sympa.%d.%d.%d.%d@%s>', $time, $usec, $PID,
(int rand 999), $domain;
}
1;
......@@ -1110,7 +1108,8 @@ Is the user listmaster?
=item unique_message_id ( $that )
TBD
Generates a unique message ID enclosed by C<E<lt>> and C<E<gt>>,
then returns it.
=back
......
......@@ -1165,8 +1165,11 @@ our %pinfo = (
'Header fields removed when a mailing list is setup in anonymous mode',
gettext_comment =>
"See \"anonymous_sender\" list parameter.\nDefault value prior to Sympa 6.1.19 is:\n Sender,X-Sender,Received,Message-id,From,X-Envelope-To,Resent-From,Reply-To,Organization,Disposition-Notification-To,X-Envelope-From,X-X-Sender",
# These were aded on 6.2.68:
# Fax, Mailer, Originating-Client, Phone, Telefax, User-Agent,
# X-Face, X-Mailer, X-MimeOLE, X-Newsreader.
default =>
'Authentication-Results,Disposition-Notification-To,DKIM-Signature,Injection-Info,Organisation,Organization,Original-Recipient,Originator,Path,Received,Received-SPF,Reply-To,Resent-Reply-To,Return-Receipt-To,X-Envelope-From,X-Envelope-To,X-Sender,X-X-Sender',
'Authentication-Results,Disposition-Notification-To,DKIM-Signature,Fax,Injection-Info,Mailer,Organisation,Organization,Original-Recipient,Originating-Client,Originator,Path,Phone,Received,Received-SPF,Reply-To,Resent-Reply-To,Return-Receipt-To,Telefax,User-Agent,X-Envelope-From,X-Envelope-To,X-Face,X-Mailer,X-MimeOLE,X-Newsreader,X-Sender,X-X-Sender',
split_char => ',',
},
......
......@@ -187,8 +187,13 @@ sub new {
$data->{'fromlist'} = Sympa::get_address($list, 'owner');
}
}
$data->{'boundary'} = '----------=_' . Sympa::unique_message_id($robot_id)
my $unique_id = Sympa::unique_message_id($robot_id);
$data->{'boundary'} = sprintf '----------=_%s', $unique_id
unless $data->{'boundary'};
$data->{'boundary1'} = sprintf '---------=1_%s', $unique_id
unless $data->{'boundary1'};
$data->{'boundary2'} = sprintf '---------=2_%s', $unique_id
unless $data->{'boundary2'};
my $self = $class->_new_from_template($that, $tpl . '.tt2',
$who, $data, %options);
......
......@@ -101,8 +101,6 @@ sub _twist {
$list->{'name'}, $arc
),
msg_list => [@msg_list],
boundary1 => Sympa::unique_message_id($list),
boundary2 => Sympa::unique_message_id($list),
auto_submitted => 'auto-replied'
};
unless (Sympa::send_file($list, 'get_archive', $sender, $param)) {
......
......@@ -94,8 +94,6 @@ sub _twist {
$list->{'name'}
),
msg_list => [@msglist],
boundary1 => Sympa::unique_message_id($list),
boundary2 => Sympa::unique_message_id($list),
auto_submitted => 'auto-replied'
};
unless (Sympa::send_file($list, 'get_archive', $sender, $param)) {
......
......@@ -91,8 +91,6 @@ sub _twist {
$sender,
{ 'spool' => \@spool, #FIXME: Use msg_list.
'total' => scalar(@spool),
'boundary1' => "==main $now[6].$now[5].$now[4].$now[3]==",
'boundary2' => "==digest $now[6].$now[5].$now[4].$now[3]=="
}
)
) {
......
......@@ -164,8 +164,6 @@ sub _distribute_digest {
my $param = {
'replyto' => Sympa::get_address($list, 'owner'),
'to' => Sympa::get_address($list),
'boundary1' => '----------=_' . Sympa::unique_message_id($list),
'boundary2' => '----------=_' . Sympa::unique_message_id($list),
};
# Compat. to 6.2a or earlier
$param->{'table_of_content'} = $language->gettext("Table of contents:");
......
......@@ -82,9 +82,8 @@ sub _twist {
$message->replace_header('From',
$list->{'admin'}{'anonymous_sender'});
$message->delete_header('Resent-From');
my $new_id =
$list->{'name'} . '.' . $message->{xsequence} . '@anonymous';
$message->replace_header('Message-Id', "<$new_id>");
my $new_id = Sympa::unique_message_id();
$message->replace_header('Message-Id', $new_id);
$message->delete_header('Resent-Message-Id');
# Duplicate topic file by new message ID.
......
......@@ -135,8 +135,6 @@ sub flush {
auto_submitted => 'auto-generated',
operation => $operation,
notification_messages => $messages{$rcpt},
boundary => '----------=_'
. Sympa::unique_message_id($robot_id)
};
$log->syslog('info', 'Send messages to %s', $rcpt);
......
......@@ -53,7 +53,7 @@ sub store {
my $topic_list = $self->{topic};
my $method = $self->{method};
my $msg_id = $message->{message_id};
my $msg_id = ($message->{message_id} =~ s/\A<(.*)>\z/$1/r);
my $list = $message->{context};
return undef unless $msg_id and ref $list eq 'Sympa::List';
......
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