Commit a3644332 authored by david.verdin's avatar david.verdin
Browse files

[*feature] All Sympa spools are now moved to database. The spools can be...

[*feature] All Sympa spools are now moved to database. The spools can be consulted and modified through the Sympa web interface. This allows to easily share the Sympa spools between several servers.
New daemon spooler.pl: this daemon parses the msg, automatic and bounce spools that stil exist on the filesystem. Any message found in these spools will be transfered to database. The other Sympa daemon now query regularly the database to find the messages (or tasks) to process.
After upgrading to this version, you MUST update your Sympa init script according to the distribute version, otherwise spooler.pl won't start.
New parameters: pidfile_spooler (name of the pidfile for spooler.pl) viewmail_dir (the directory containing the HTML version of messages in spool).
Deprecated parameter: pidfile_distribute.
[*change] the old bulkspool_table is now replaced by spool_table which contains far more fields for greater versatility.



git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@7679 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent d3bfbe05
......@@ -21,7 +21,7 @@ Content-Disposition: inline
[%- IF spam_status == 'spam' -%]
[%|loc%]Because the new message is suspected to be a spam it is not attached to this one. You must use the web interface to reject or validate it.[%END%]
[%- ELSE -%]
[%- ELSE -%]
[% IF ! request_topic %]
[%|loc(list.name)%]To distribute the attached message in list %1:[%END%]
<[% FILTER escape_url %]mailto:[%conf.sympa%]?subject=DISTRIBUTE [%list.name%] [%modkey%][% END %]>
......@@ -29,7 +29,8 @@ Content-Disposition: inline
DISTRIBUTE [% list.name %] [% modkey %]
[%|loc%]To reject it (it will be removed):[%END%]
<[% FILTER escape_url %]mailto:[%conf.sympa%]?subject=REJECT [%list.name%] [%modkey%][% END %]>
<[% FILTER escape_url %]mailto:[%conf.sympa%]?subject=REJECT [%list.name%] [%modkey%]
[% END %]>
[%|loc(conf.email,conf.host)%]Or send a message to %1@%2 with the following subject:[%END%]
REJECT [% list.name %] [% modkey %]
[%END%]
......@@ -39,11 +40,9 @@ REJECT [% list.name %] [% modkey %]
Content-Type: message/rfc822
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
X-Sympa-Attach: yes
[% INSERT $msg_path IF msg_path %]
X-Sympa-Attach: Yes
[% msg_as_string %]
--[% boundary %]--
[%- END -%]
[% END %]
[% END -%]
......@@ -11071,10 +11071,6 @@ msgstr "interrumpir la recepción de mensajes (útil para las vacaciones)"
msgid "you do not receive your own posts"
msgstr "No recibir mis propios mensajes"
#: ../src/lib/confdef.pm:662
msgid "Plugin"
msgstr ""
#~ msgid "Customizing: "
#~ msgstr "Personalizar:"
......
......@@ -23,7 +23,7 @@ SUBDIRS = etc lib
AM_CPPFLAGS = -DCONFIG=\"$(CONFIG)\"
sbin_SCRIPTS = sympa.pl bulk.pl alias_manager.pl task_manager.pl sympa_wizard.pl
sbin_SCRIPTS = sympa.pl bulk.pl spooler.pl alias_manager.pl task_manager.pl sympa_wizard.pl
sbin_PROGRAMS = aliaswrapper virtualwrapper
aliaswrapper_SOURCES = aliaswrapper.c
aliaswrapper_CPPFLAGS = $(AM_CPPFLAGS) \
......@@ -46,6 +46,7 @@ EXTRA_DIST = $(modules_DATA) \
bulk.pl.in \
alias_manager.pl.in \
sympa.pl.in \
spooler.pl.in \
sympa_wizard.pl.in \
task_manager.pl.in
......@@ -72,7 +73,7 @@ install-exec-hook:
-chgrp $(GROUP) $(DESTDIR)$(sbindir)/virtualwrapper
chmod 4750 $(DESTDIR)$(sbindir)/virtualwrapper
alias_manager.pl bulk.pl task_manager.pl sympa.pl sympa_wizard.pl: Makefile
alias_manager.pl bulk.pl task_manager.pl sympa.pl spooler.pl sympa_wizard.pl: Makefile
rm -f $@
$(AM_V_GEN)$(SED) \
-e 's|--PERL--|$(PERL)|' \
......@@ -83,5 +84,6 @@ alias_manager.pl bulk.pl task_manager.pl sympa.pl sympa_wizard.pl: Makefile
alias_manager.pl: $(srcdir)/alias_manager.pl.in
bulk.pl: $(srcdir)/bulk.pl.in
sympa.pl: $(srcdir)/sympa.pl.in
spooler.pl: $(srcdir)/spooler.pl.in
sympa_wizard.pl: $(srcdir)/sympa_wizard.pl.in
task_manager.pl: $(srcdir)/task_manager.pl.in
......@@ -104,7 +104,7 @@ main(int argn, char **argv)
exit(EX_NOPERM);
}
umask(027);
snprintf(qfile, sizeof(qfile), "T.%s.%ld.%d", listname, time(NULL), getpid());
snprintf(qfile, sizeof(qfile), "T.Sympa_Bounce.%s.%ld.%d", listname, time(NULL), getpid());
fd = open(qfile, O_CREAT|O_WRONLY, 0600);
if (fd == -1)
exit(EX_TEMPFAIL);
......
......@@ -45,13 +45,14 @@ use Conf;
use Log;
use Commands;
use Getopt::Long;
use Data::Dumper;
use mail;
use Bulk;
use List;
use tools;
use tracking;
use Sympa::Constants;
use Sympaspool;
my $daemon_name = &Log::set_daemon($0);
my $date_of_last_activity = time();
......@@ -169,6 +170,9 @@ my %created_children;
$options->{'multiple_process'} = 1;
$Conf::Conf{'maxsmtp'} = int($Conf::Conf{'maxsmtp'}/$Conf::Conf{'bulk_max_count'});
my $spool = new Sympaspool('bulk');
while (!$end) {
&List::init_list_cache();
&List::send_notify_to_listmaster(undef, undef, undef, 1); # Process grouped notifications
......@@ -259,14 +263,14 @@ while (!$end) {
}
## Go through the bulk_mailer table and process messages
if ($bulk = Bulk::next()) {
if ($bulk->{'messagekey'} ne $messagekey) {
# current packet is not related to the same message as the previous packet
# so it is needed to fetch the new message from message_table
$messagekey = $bulk->{'messagekey'};
$message_from_spool = &Bulk::message_from_spool($bulk->{'messagekey'});
$message_from_spool = $spool->get_message({'messagekey' => $bulk->{'messagekey'}});
&Log::do_log('notice','Start sending message "%s" (key "%s") to list "%s@%s" (priority %s) (starting %s seconds after scheduled expedition date)',
$bulk->{'messageid'},
$bulk->{'messagekey'},
......@@ -276,7 +280,8 @@ while (!$end) {
time() - $bulk->{'delivery_date'});
$messageasstring_init = $message_from_spool->{'messageasstring'};
#my $dump = &Dumper($messageasstring_init); open (DUMP,">>/tmp/dumper"); printf DUMP 'messageasstring recup par bulk \n%s',$dump ; close DUMP;
# &trace_smime($messageasstring_init,'initial');
unless ( $messageasstring_init ) {
......@@ -287,7 +292,6 @@ while (!$end) {
}
$messagekey = $bulk->{'messagekey'};
}
my $data; #HASH which will contain the attributes of the subscriber
# Initialization of the HASH : $data. It will be used by parse_tt2 to personalized messages.
......@@ -297,7 +301,7 @@ while (!$end) {
$data->{'wwsympa_url'} = &Conf::get_robot_conf($bulk->{'robot'},'wwsympa_url');
my $rcpt; # It is the email of a subscriber, use it in the foreach
my @rcpts = split /,/,$bulk->{'receipients'}; # Contain all the subscribers
my @rcpts = split /,/,$bulk->{'receipients'}; # / Contain all the subscribers
## Use an intermediate handler to encode to filesystem_encoding
my $user;
......@@ -331,7 +335,7 @@ while (!$end) {
$return_path = $Conf::Conf{'bounce_email_prefix'}.'+'.$escaped_rcpt.'=='.$listname.'=='.$notification_id.'@'.$robot;
$entity->head->replace('Disposition-Notification-To',$return_path) if ($bulk->{'tracking'} eq 'mdn') ;
if (($message->{'protected'})||($message->{'smime_crypted'})){
my $msg_body =$messageasstring_init; $msg_body =~ s/^.*\n\n//; # remove headers
my $msg_body = &Message::get_body_from_msg_as_string($messageasstring_init);
$messageasstring_init = $entity->head->as_string. "\n" . $msg_body; # concat headers from entity with original body
}else{
$messageasstring_init = $entity->as_string;
......@@ -344,7 +348,7 @@ while (!$end) {
unless(&Bulk::merge_msg ($entity, $rcpt, $bulk, $data)){
&Log::do_log('err', 'Erreur d appel &Bulk::merge_msg');
}
$messageasstring = $entity->as_string;
$messageasstring = $entity->as_string;
}else{
$messageasstring = $messageasstring_init;
}
......@@ -426,9 +430,6 @@ sub sigterm {
}
sub trace_smime {
my $messageasstring_init = shift;
......
This diff is collapsed.
......@@ -1086,4 +1086,24 @@ function hideform(my_message_id)
jQuery(document).ready(function() {
$('#noticeMsg').delay(500).fadeOut(4000);
}
);
);
function spoolPopup(msgkey, url, trigger, remove_if_divclass_present) {
if(!remove_if_divclass_present) remove_if_divclass_present = '';
jQuery('.viewspool').hide();
var p = jQuery('#viewspool' + msgkey).attr({msgkey: msgkey, ridcp: remove_if_divclass_present}).load(url, function(t, s, r) {
var p = jQuery(this), msgkey = p.attr('msgkey'), ridcp = p.attr('ridcp');
if(ridcp && p.has('.' + ridcp).length) {
p.parent().delay(2000).queue(function() {
jQuery(this).remove();
});
if(msgkey) jQuery('#spoolitem' + msgkey).delay(2000).queue(function() {
jQuery(this).remove();
});
}
}).parent().show();
if(!p.parent().is('body')) {
var pos = (trigger ? jQuery(trigger) : p.parent()).offset();
p.detach().appendTo(jQuery('body')).css({'top': pos.top, 'left': pos.left, 'width': (jQuery('body').innerWidth() - pos.left - 100) + 'px', 'z-index': 10000});
}
}
......@@ -228,6 +228,7 @@ case "$1" in
if [ ! -f ${sympalockdir}/sympa ]; then
echo "Starting Sympa subsystem: "
sympa_start sympa
sympa_start spooler
sympa_start bulk
sympa_start archived
sympa_start bounced
......@@ -243,6 +244,7 @@ case "$1" in
;;
stop)
echo "Stopping Sympa subsystem: "
sympa_stop spooler
sympa_stop bounced
sympa_stop archived
sympa_stop bulk
......@@ -265,6 +267,7 @@ case "$1" in
else
echo "Status file for subsystem NOT found."
fi
sympa_status spooler
sympa_status sympa
sympa_status bulk
sympa_status archived
......
......@@ -118,7 +118,7 @@ main(int argn, char **argv)
exit(EX_NOPERM);
}
umask(027);
snprintf(qfile, sizeof(qfile), "T.%s.%ld.%d", listname, time(NULL), getpid());
snprintf(qfile, sizeof(qfile), "T.Sympa_Automatic.%s.%ld.%d", listname, time(NULL), getpid());
fd = open(qfile, O_CREAT|O_WRONLY, 0600);
if (fd == -1){
char* buffer=(char*)malloc(strlen(argv[0])+strlen(queuedir)+80);
......
......@@ -22,7 +22,7 @@
package Archive;
use strict;
use Cwd;
use Encode qw(decode_utf8 encode_utf8);
use HTML::Entities qw(decode_entities);
......@@ -32,50 +32,6 @@ my $serial_number = 0; # incremented on each archived mail
## RCS identification.
## copie a message in $dir using a unique file name based on liSTNAME
sub outgoing {
my($dir,$list_id,$msg) = @_;
&Log::do_log ('debug2',"outgoing for list $list_id to directory $dir");
return 1 if ($dir eq '/dev/null');
## ignoring message with a no-archive flag
if (ref($msg) &&
($Conf::Conf{'ignore_x_no_archive_header_feature'} ne 'on') &&
(($msg->head->get('X-no-archive') =~ /yes/i) || ($msg->head->get('Restrict') =~ /no\-external\-archive/i))) {
&Log::do_log('info',"Do not archive message with no-archive flag for list $list_id");
return 1;
}
## Create the archive directory if needed
unless (-d $dir) {
mkdir ($dir, 0775);
chmod 0774, $dir;
&Log::do_log('info',"creating $dir");
}
my @now = localtime(time);
# my $prefix= sprintf("%04d-%02d-%02d-%02d-%02d-%02d",1900+$now[5],$now[4]+1,$now[3],$now[2],$now[1],$now[0]);
# my $filename = "$dir"."/"."$prefix-$list_id";
my $filename = sprintf '%s/%s.%d.%d.%d', $dir, $list_id, time, $$, $serial_number;
$serial_number = ($serial_number+1)%100000;
unless ( open(OUT, "> $filename")) {
&Log::do_log('info',"error unable open outgoing dir $dir for list $list_id");
return undef;
}
&Log::do_log('debug',"put message in $filename");
if (ref ($msg)) {
$msg->print(\*OUT);
}else {
print OUT $msg;
}
close (OUT);
}
## Does the real job : stores the message given as an argument into
## the indicated directory.
......@@ -202,11 +158,11 @@ sub search_msgid {
&Log::do_log('err','remove_arc: no message id found');return undef;
}
unless ($dir =~ /\d\d\d\d\-\d\d\/arctxt/) {
&Log::do_log ('info',"archive::search_msgid : dir $dir look unproper");
&Log::do_log ('err',"archive::search_msgid : dir $dir look unproper");
return undef;
}
unless (opendir (ARC, "$dir")){
&Log::do_log ('info',"archive::scan_dir_archive($dir, $msgid): unable to open dir $dir");
&Log::do_log ('err',"archive::scan_dir_archive($dir, $msgid): unable to open dir $dir");
return undef;
}
chomp $msgid ;
......@@ -287,6 +243,132 @@ sub load_html_message {
return \%metadata;
}
1;
sub clean_archive_directory{
my $params = shift;
&Log::do_log('debug',"Cleaning archives for directory '%s'.",$params->{'arc_root'}.'/'.$params->{'dir_to_rebuild'});
my $answer;
$answer->{'dir_to_rebuild'} = $params->{'arc_root'}.'/'.$params->{'dir_to_rebuild'};
$answer->{'cleaned_dir'} = $Conf::Conf{'tmpdir'}.'/'.$params->{'dir_to_rebuild'};
unless(my $number_of_copies = &tools::copy_dir($answer->{'dir_to_rebuild'},$answer->{'cleaned_dir'})){
&Log::do_log('err',"Unable to create a temporary directory where to store files for HTML escaping (%s). Cancelling.",$number_of_copies);
return undef;
}
if(opendir ARCDIR,$answer->{'cleaned_dir'}){
my $files_left_uncleaned = 0;
foreach my $file (readdir(ARCDIR)){
next if($file =~ /^\./);
$file = $answer->{'cleaned_dir'}.'/'.$file;
$files_left_uncleaned++ unless(&clean_archived_message({'input'=>$file ,'output'=>$file}));
}
closedir DIR;
if ($files_left_uncleaned) {
&Log::do_log('err',"HTML cleaning failed for %s files in the directory %s.",$files_left_uncleaned,$answer->{'dir_to_rebuild'});
}
$answer->{'dir_to_rebuild'} = $answer->{'cleaned_dir'};
}else{
&Log::do_log('err','Unable to open directory %s: %s',$answer->{'dir_to_rebuild'},$!);
&tools::del_dir($answer->{'cleaned_dir'});
return undef;
}
return $answer;
}
sub clean_archived_message{
my $params = shift;
&Log::do_log('debug',"Cleaning HTML parts of a message input %s , output %s ",$params->{'input'},$params->{'output'});
my $input = $params->{'input'};
my $output = $params->{'output'};
if (my $msg = new Message({'file'=>$input})){
if($msg->clean_html()){
if(open TMP, ">$output") {
print TMP $msg->{'msg'}->as_string;
close TMP;
}else{
&Log::do_log('err','Unable to create a tmp file to write clean HTML to file %s',$output);
return undef;
}
}else{
&Log::do_log('err','HTML cleaning in file %s failed.',$output);
return undef;
}
}else{
&Log::do_log('err','Unable to create a Message object with file %s',$input);
exit;
return undef;
}
}
#############################
# convert a messsage to html.
# result is stored in $destination_dir
# attachement_url is used to link attachement
#
sub convert_single_msg_2_html {
my $data =shift;
my $msg_as_string = $data->{'msg_as_string'};
my $destination_dir = $data->{'destination_dir'};
my $attachement_url = $data->{'attachement_url'};
my $list = $data->{'list'};
my $robot = $data->{'robot'};
my $messagekey = $data->{'messagekey'};
my $listname =''; my $msg_file;
my $host = $robot;
if ($list) {
$host = $list->{'admin'}{'host'};
$robot = $list->{'robot'};
$listname = $list->{'name'};
$msg_file = &Conf::get_robot_conf($robot, 'tmpdir').'/'.$list->get_list_id().'_'.$$;
}else{
$msg_file = &Conf::get_robot_conf($robot, 'tmpdir').'/'.$messagekey.'_'.$$;
}
my $pwd = getcwd; # mhonarc require du change workdir so this proc must retore it
unless (open(OUT, ">$msg_file")) {
&Log::do_log('notice', 'Could Not open %s', $msg_file);
return undef;
}
printf OUT $msg_as_string ;
close(OUT);
unless (-d $destination_dir) {
unless (&tools::mkdir_all($destination_dir, 0777)) {
&Log::do_log('err','Unable to create %s', $destination_dir);
return undef;
}
}
my $mhonarc_ressources = &tools::get_filename('etc',{},'mhonarc-ressources.tt2', $robot,$list);
unless ($mhonarc_ressources) {
&Log::do_log('notice',"Cannot find any MhOnArc ressource file");
return undef;
}
## generate HTML
unless (chdir $destination_dir) {
&Log::do_log('err',"Could not change working directory to %s",$destination_dir);
}
my $tracepwd = getcwd ;
my $mhonarc = &Conf::get_robot_conf($robot, 'mhonarc');
my $base_url = &Conf::get_robot_conf($robot, 'wwsympa_url');
#open ARCMOD, "$mhonarc -single --outdir .. -rcfile $mhonarc_ressources -definevars listname=$listname -definevars hostname=$host -attachmenturl=$attachement_url $msg_file |";
#open MSG, ">msg00000.html";
#&Log::do_log('debug', "$mhonarc --outdir .. -single -rcfile $mhonarc_ressources -definevars listname=$listname -definevars hostname=$host $msg_file");
#print MSG <ARCMOD>;
#close MSG;
#close ARCMOD;
`$mhonarc -single --outdir .. -rcfile $mhonarc_ressources -definevars listname=$listname -definevars hostname=$host -attachmenturl=$attachement_url $msg_file > msg00000.html`;
# restore current wd
chdir $pwd;
return 1;
}
1;
......@@ -26,6 +26,7 @@ use Fcntl qw(LOCK_SH LOCK_EX LOCK_NB LOCK_UN);
use Carp;
use IO::Scalar;
use Storable;
use Data::Dumper;
use Mail::Header;
use Mail::Address;
use Time::HiRes qw(time);
......@@ -38,6 +39,8 @@ use MIME::Base64;
use Term::ProgressBar;
use URI::Escape;
use constant MAX => 100_000;
use Sys::Hostname;
use Lock;
use Task;
......@@ -58,8 +61,8 @@ use SDM;
my $sth;
# fingerprint of last message stored in bulkspool
my $message_fingerprint;
# last message stored in spool, this global var is used to prevent multiple stored of the same message in spool table
my $last_stored_message_key;
# create an empty Bulk
#sub new {
......@@ -99,7 +102,7 @@ sub next {
}
my $packet;
unless($packet = $sth->fetchrow_hashref('NAME_lc')){
unless($packet = $sth->fetchrow_hashref('NAME_lc')){
return undef;
}
......@@ -382,6 +385,7 @@ sub store {
&Log::do_log('debug', 'Bulk::store(<msg>,<rcpts>,from = %s,robot = %s,listname= %s,priority_message = %s, delivery_date= %s,verp = %s, tracking = %s, merge = %s, dkim: d= %s i=%s, last: %s)',$from,$robot,$listname,$priority_message,$delivery_date,$verp,$tracking, $merge,$dkim->{'d'},$dkim->{'i'},$tag_as_last);
$priority_message = &Conf::get_robot_conf($robot,'sympa_priority') unless ($priority_message);
$priority_packet = &Conf::get_robot_conf($robot,'sympa_packet_priority') unless ($priority_packet);
......@@ -393,54 +397,46 @@ sub store {
if ($message->{'protected'}) {
$msg = $message->{'msg_as_string'};
}
my @sender_hdr = Mail::Address->parse($message->{'msg'}->head->get('From'));
my $message_sender = $sender_hdr[0]->address;
$msg = MIME::Base64::encode($msg);
##-----------------------------##
my $messagekey = &tools::md5_fingerprint($msg);
# first store the message in bulk_spool_table
# because as soon as packet are created bulk.pl may distribute them
# Compare the current message finger print to the fingerprint
# of the last call to store() ($message_fingerprint is a global var)
# If fingerprint is the same, then the message should not be stored
# again in bulkspool_table
my $message_already_on_spool;
# first store the message in spool_table
# because as soon as packet are created bulk.pl may distribute the
# $last_stored_message_key is a global var used in order to detcect if a message as been allready stored
my $message_already_on_spool ;
my $bulkspool = new Sympaspool ('bulk');
if ($messagekey eq $message_fingerprint) {
if (($last_stored_message_key) && ($message->{'messagekey'} eq $last_stored_message_key)) {
$message_already_on_spool = 1;
}else {
## search if this message is already in spool database : mailfile may perform multiple submission of exactly the same message
unless ($sth = &SDM::do_query("SELECT count(*) FROM bulkspool_table WHERE ( messagekey_bulkspool = %s )", &SDM::quote($messagekey))) {
&Log::do_log('err','Unable to check whether message %s is in spool already', $messagekey);
return undef;
}
$message_already_on_spool = $sth->fetchrow;
$sth->finish();
# if message is not found in bulkspool_table store it
if ($message_already_on_spool == 0) {
unless (&SDM::do_query( "INSERT INTO bulkspool_table (messagekey_bulkspool, messageid_bulkspool, message_bulkspool, lock_bulkspool, dkim_d_bulkspool,dkim_i_bulkspool,dkim_selector_bulkspool, dkim_privatekey_bulkspool) VALUES (%s, %s, %s, 1, %s, %s, %s ,%s)",&SDM::quote($messagekey),&SDM::quote($msg_id),&SDM::quote($msg),&SDM::quote($dkim->{d}), &SDM::quote($dkim->{i}),&SDM::quote($dkim->{selector}),&SDM::quote($dkim->{private_key}))) {
&Log::do_log('err','Unable to add message %s to database spool', $msg_id);
}else{
my $lock = $$.'@'.hostname() ;
if ($message->{'messagekey'}) {
# move message to spool bulk and keep it locked
$bulkspool->update({'messagekey'=>$message->{'messagekey'}},{'messagelock'=>$lock,'spoolname'=>'bulk','message' => $msg});
&Log::do_log('debug',"moved message to spool bulk");
}else{
$message->{'messagekey'} = $bulkspool->store($msg,
{'dkim_d'=>$dkim->{d},
'dkim_i'=>$dkim->{i},
'dkim_selector'=>$dkim->{selector},
'dkim_privatekey'=>$dkim->{private_key},
'dkim_header_list'=>$dkim->{header_list}},
$lock);
unless($message->{'messagekey'}) {
&Log::do_log('err',"could not store message in spool distribute, message lost ?");
return undef;
}
#log in stat_table to make statistics...
unless($message_sender =~ /($robot)\@/) { #ignore messages sent by robot
unless ($message_sender =~ /($listname)-request/) { #ignore messages of requests
&Log::db_stat_log({'robot' => $robot, 'list' => $listname, 'operation' => 'send_mail', 'parameter' => length($msg),
'mail' => $message_sender, 'client' => '', 'daemon' => 'sympa.pl'});
}
}
$last_stored_message_key = $message->{'messagekey'};
#log in stat_table to make statistics...
unless($message_sender =~ /($robot)\@/) { #ignore messages sent by robot
unless ($message_sender =~ /($listname)-request/) { #ignore messages of requests
&Log::db_stat_log({'robot' => $robot, 'list' => $listname, 'operation' => 'send_mail', 'parameter' => length($msg),
'mail' => $message_sender, 'client' => '', 'daemon' => 'sympa.pl'});
}
$message_fingerprint = $messagekey;
}
}
......@@ -479,30 +475,26 @@ sub store {
}
if ($message_already_on_spool) {
## search if this packet is already in spool database : mailfile may perform multiple submission of exactly the same message
unless ($sth = &SDM::do_query( "SELECT count(*) FROM bulkmailer_table WHERE ( messagekey_bulkmailer = %s AND packetid_bulkmailer = %s)", &SDM::quote($messagekey),&SDM::quote($packetid))) {
&Log::do_log('err','Unable to check presence of packet %s of message %s in database', $packetid, $messagekey);
unless ($sth = &SDM::do_query( "SELECT count(*) FROM bulkmailer_table WHERE ( messagekey_bulkmailer = %s AND packetid_bulkmailer = %s)", &SDM::quote($message->{'messagekey'}),&SDM::quote($packetid))) {
&Log::do_log('err','Unable to check presence of packet %s of message %s in database', $packetid, $message->{'messagekey'});
return undef;
}
$packet_already_exist = $sth->fetchrow;
$sth->finish();
}
if ($packet_already_exist) {
&Log::do_log('err','Duplicate message not stored in bulmailer_table');
}else {
unless (&SDM::do_query( "INSERT INTO bulkmailer_table (messagekey_bulkmailer,messageid_bulkmailer,packetid_bulkmailer,receipients_bulkmailer,returnpath_bulkmailer,robot_bulkmailer,listname_bulkmailer, verp_bulkmailer, tracking_bulkmailer, merge_bulkmailer, priority_message_bulkmailer, priority_packet_bulkmailer, reception_date_bulkmailer, delivery_date_bulkmailer) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", &SDM::quote($messagekey),&SDM::quote($msg_id),&SDM::quote($packetid),&SDM::quote($rcptasstring),&SDM::quote($from),&SDM::quote($robot),&SDM::quote($listname),$verp,&SDM::quote($tracking),$merge,$priority_message, $priority_for_packet, $current_date,$delivery_date)) {
if ($packet_already_exist) {
&Log::do_log('err','Duplicate message not stored in bulmailer_table');
}else {
unless (&SDM::do_query( "INSERT INTO bulkmailer_table (messagekey_bulkmailer,messageid_bulkmailer,packetid_bulkmailer,receipients_bulkmailer,returnpath_bulkmailer,robot_bulkmailer,listname_bulkmailer, verp_bulkmailer, tracking_bulkmailer, merge_bulkmailer, priority_message_bulkmailer, priority_packet_bulkmailer, reception_date_bulkmailer, delivery_date_bulkmailer) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", &SDM::quote($message->{'messagekey'}),&SDM::quote($msg_id),&SDM::quote($packetid),&SDM::quote($rcptasstring),&SDM::quote($from),&SDM::quote($robot),&SDM::quote($listname),$verp,&SDM::quote($tracking),$merge,$priority_message, $priority_for_packet, $current_date,$delivery_date)) {
&Log::do_log('err','Unable to add packet %s of message %s to database spool',$packetid,$msg_id);
return undef;
}
}
}
}