Commit ec891b2a authored by sikeda's avatar sikeda
Browse files

[-dev] Using Sympa::sene_file() instead of Sympa::Report::notice_report_msg().


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12586 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent fa85f197
......@@ -455,7 +455,7 @@ sub new_from_template {
}
# Set default delivery date.
$self->{date} = time;
$self->{date} = (exists $options{date}) ? $options{date} : time;
# Assign unique ID and log it.
my $marshalled =
......
......@@ -31,7 +31,6 @@ use Sympa;
use Conf;
use Sympa::Language;
use Sympa::Log;
use Sympa::Report;
use Sympa::Tools::Data;
use base qw(Sympa::Spindle);
......@@ -132,21 +131,23 @@ sub _reject {
# Notify author of message.
unless ($self->{quiet}) {
unless (
Sympa::send_file($list, 'reject', $message->{sender}, $param))
{
$log->syslog('notice',
'Unable to send template "reject" to %s',
$message->{sender});
Sympa::send_dsn($list, $message, {}, '5.3.0');
}
Sympa::send_file($list, 'reject', $message->{sender}, $param)
or Sympa::send_dsn($list, $message, {}, '5.3.0'); #FIXME
}
# Notify list moderator
Sympa::Report::notice_report_msg('message_rejected',
# Notify list moderator.
# Ensure 1 second elapsed since last message.
Sympa::send_file(
$list,
'message_report',
$self->{rejected_by},
{'key' => $message->{authkey}, 'message' => $message},
$list->{'domain'}, $list);
{ type => 'success', # Compat. <=6.2.12.
entry => 'message_rejected',
auto_submitted => 'auto-replied',
key => $message->{authkey}
},
date => time + 1
);
}
1;
......
......@@ -28,10 +28,8 @@ use strict;
use warnings;
use Sympa;
use Sympa::Bulk;
use Sympa::Log;
use Sympa::Message;
use Sympa::Report;
use base qw(Sympa::Spindle);
......@@ -91,9 +89,17 @@ sub _twist {
# 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);
# Ensure 1 second elapsed since last message.
Sympa::send_file(
$list,
'message_report',
$sender,
{ type => 'success', # Compat. <=6.2.12.
entry => 'moderating_message',
auto_submitted => 'auto-replied'
},
date => time + 1
);
}
return 1;
}
......@@ -133,7 +139,6 @@ sub _send_confirm_to_editor {
'auto_submitted' => 'auto-generated',
};
my $bulk = Sympa::Bulk->new;
foreach my $recipient (@rcpt) {
my $new_message = $message->dup;
if ($new_message->{'smime_crypted'}) {
......@@ -154,17 +159,12 @@ sub _send_confirm_to_editor {
}
$param->{'msg'} = $new_message;
my $confirm_message =
Sympa::Message->new_from_template($list, 'moderate', $recipient,
$param);
if ($confirm_message) {
# Ensure 1 second elapsed since last message
$confirm_message->{'date'} = time + 1;
}
unless ($confirm_message
and defined $bulk->store($confirm_message, $recipient)) {
$log->syslog('notice', 'Unable to send template "moderate" to %s',
$recipient);
# Ensure 1 second elapsed since last message.
unless (
Sympa::send_file(
$list, 'moderate', $recipient, $param, date => time + 1
)
) {
return undef;
}
}
......
......@@ -29,9 +29,7 @@ use warnings;
use Time::HiRes qw();
use Sympa;
use Sympa::Bulk;
use Sympa::Log;
use Sympa::Message;
use Sympa::Spool::Held;
use base qw(Sympa::Spindle);
......@@ -127,17 +125,12 @@ sub _send_confirm_to_sender {
#'file' => $message->{'filename'}, # obsoleted (<=6.1)
};
my $confirm_message =
Sympa::Message->new_from_template($list, 'send_auth', $sender,
$param);
if ($confirm_message) {
# Ensure 1 second elapsed since last message
$confirm_message->{'date'} = time + 1;
}
unless ($confirm_message
and defined Sympa::Bulk->new->store($confirm_message, $sender)) {
$log->syslog('notice', 'Unable to send template "send_auth" to %s',
$sender);
# Ensure 1 second elapsed since last message.
unless (
Sympa::send_file(
$list, 'send_auth', $sender, $param, date => time + 1
)
) {
return undef;
}
......
......@@ -32,7 +32,6 @@ use Sympa;
use Sympa::Bulk;
use Conf;
use Sympa::Log;
use Sympa::Report;
use Sympa::Tools::Data;
use Sympa::Topic;
use Sympa::Tracking;
......@@ -80,13 +79,31 @@ sub _twist {
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);
# Ensure 1 second elapsed since last message.
Sympa::send_file(
$list,
'message_report',
$self->{confirmed_by},
{ type => 'success', # Compat. <=6.2.12.
entry => 'message_confirmed',
auto_submitted => 'auto-replied',
key => $self->{authkey}
},
date => time + 1
);
} elsif ($self->{distributed_by}) {
Sympa::Report::notice_report_msg('message_distributed', $sender,
{'key' => $self->{authkey}, 'message' => $message},
$list->{'domain'}, $list);
# Ensure 1 second elapsed since last message.
Sympa::send_file(
$list,
'message_report',
$self->{distributed_by},
{ type => 'success', # Compat. <=6.2.12.
entry => 'message_distributed',
auto_submitted => 'auto-replied',
key => $self->{authkey}
},
date => time + 1
);
}
# No notification sent to {resent_by} user.
}
......
......@@ -30,10 +30,8 @@ use Time::HiRes qw();
use Sympa;
use Sympa::Auth;
use Sympa::Bulk;
use Sympa::Log;
use Sympa::Message;
use Sympa::Report;
use Sympa::Spool::Moderation;
use base qw(Sympa::Spindle);
......@@ -97,9 +95,17 @@ sub _twist {
# 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);
# Ensure 1 second elapsed since last message.
Sympa::send_file(
$list,
'message_report',
$sender,
{ type => 'success', # Comapt. <=6.2.12.
entry => 'moderating_message',
auto_submitted => 'auto-replied'
},
date => time + 1
);
}
return 1;
}
......@@ -158,7 +164,6 @@ sub _send_confirm_to_editor {
'auto_submitted' => 'auto-generated',
};
my $bulk = Sympa::Bulk->new;
foreach my $recipient (@rcpt) {
my $new_message = $message->dup;
if ($new_message->{'smime_crypted'}) {
......@@ -200,17 +205,12 @@ sub _send_confirm_to_editor {
);
}
my $confirm_message =
Sympa::Message->new_from_template($list, 'moderate', $recipient,
$param);
if ($confirm_message) {
# Ensure 1 second elapsed since last message
$confirm_message->{'date'} = time + 1;
}
unless ($confirm_message
and defined $bulk->store($confirm_message, $recipient)) {
$log->syslog('notice', 'Unable to send template "moderate" to %s',
$recipient);
# Ensure 1 second elapsed since last message.
unless (
Sympa::send_file(
$list, 'moderate', $recipient, $param, date => time + 1
)
) {
return undef;
}
}
......
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