Added flag for flushing quarantined mail

This commit is contained in:
Jamie Cameron
2009-05-12 22:02:47 +00:00
parent a66230b57c
commit 0248775cb1
4 changed files with 31 additions and 15 deletions

View File

@@ -42,3 +42,5 @@ Added a Module Config option to control if the user is prompted for confirmation
A custom command to rebuild all maps can be specified on the Module Config page, to be used instead of makemap or newaliases.
---- Changes since 1.450 ----
Changed the mail queue date format to yyyy/mm/dd, for easier sorting.
---- Changes since 1.480 ----
When flushing selected queued quarantined messages, the -qQ flag is added so that it actually works.

View File

@@ -13,20 +13,32 @@ if ($in{'flush'}) {
$access{'flushq'} || &error($text{'flushq_ecannot'});
&ui_print_unbuffered_header(undef, $text{'flushq_title'}, "");
$cmd = "$config{'sendmail_path'} -v -C$config{'sendmail_cf'}";
foreach $file (@files) {
$file =~ s/^.*\///;
$cmd .= " -qI$file";
# Split into quarantined and non-quarantined messages
local @mails = map { &mail_from_queue($_) } @files;
local @quar = grep { $_->{'quar'} } @mails;
local @nonquar = grep { !$_->{'quar'} } @mails;
foreach $ml (\@quar, \@nonquar) {
next if (!@$ml);
@files = map { $_->{'file'} } @$ml;
$cmd = "$config{'sendmail_path'} -v -C$config{'sendmail_cf'}";
if ($ml->[0]->{'quar'}) {
$cmd .= " -qQ";
}
foreach $file (@files) {
$file =~ s/^.*\///;
$cmd .= " -qI$file";
}
if ($config{'mailq_order'}) {
$cmd .= " -O QueueSortOrder=$config{'mailq_order'}";
}
print &text('flushq_desc2', scalar(@files)),"\n";
print "<pre>";
&foreign_require("proc", "proc-lib.pl");
&foreign_call("proc", "safe_process_exec_logged", $cmd, 0, 0,
STDOUT, undef, 1);
print "</pre>\n";
}
if ($config{'mailq_order'}) {
$cmd .= " -O QueueSortOrder=$config{'mailq_order'}";
}
print &text('flushq_desc2', scalar(@files)),"\n";
print "<pre>";
&foreign_require("proc", "proc-lib.pl");
&foreign_call("proc", "safe_process_exec_logged", $cmd, 0, 0,
STDOUT, undef, 1);
print "</pre>\n";
&webmin_log("flushq", undef, scalar(@files));
}
else {

View File

@@ -82,7 +82,7 @@ if (@qfiles) {
}
# Show the queued mails
&mailq_table([ @qfiles[$s .. $e] ], \%qmails);
$quarcount = &mailq_table([ @qfiles[$s .. $e] ], \%qmails);
# Show queue search form
print "<form action=mailq_search.cgi>\n";

View File

@@ -535,10 +535,11 @@ else {
}
# mailq_table(&qfiles)
# Print a table showing queued emails
# Print a table showing queued emails. Returns the number quarantined.
sub mailq_table
{
local ($qfiles, $qmails) = @_;
local $quarcount;
# Show buttons to flush and delete
print "<form action=del_mailqs.cgi method=post>\n";
@@ -638,6 +639,7 @@ if ($access{'mailq'} == 2) {
print "<p>\n";
}
print "</form>\n";
return $quarcount;
}
# is_table_comment(line, [force-prefix])