}
}
+# get_global_spam_delete()
+# Returns the global score above which spam is deleted, typically by a
+# Virtualmin per-domain procmail file
+sub get_global_spam_delete
+{
+if ($virtualmin_domain_id) {
+ # Read the Virtualmin procmailrc for the domain
+ local $vmpmrc = "$config{'virtualmin_config'}/procmail/".
+ $virtualmin_domain_id;
+ local @vmrecipes = &procmail::parse_procmail_file($vmpmrc);
+ local ($spamrec, $level) = &spam::find_delete_recipe(\@vmrecipes);
+ if ($spamrec) {
+ return $level;
+ }
+ }
+# Also check the global /etc/procmailrc
+local @recipes = &procmail::parse_procmail_file(
+ $spam::config{'global_procmailrc'});
+local ($spamrec, $level) = &spam::find_delete_recipe(\@recipes);
+if ($spamrec) {
+ return $level;
+ }
+else {
+ return undef;
+ }
+}
+
sub has_spamassassin
{
return &foreign_installed("spam");
}
@filters = &list_filters();
-@links = ( &select_all_link("d"), &select_invert_link("d"),
- "<a href='edit.cgi?new=1'>$text{'index_add'}</a>" );
+@links = ( );
+if (@filters) {
+ push(@links, &select_all_link("d"), &select_invert_link("d"));
+ }
+push(@links, "<a href='edit.cgi?new=1'>$text{'index_add'}</a>");
($auto) = grep { $_->{'actionreply'} } @filters;
if (&can_simple_autoreply() && !$auto) {
push(@links, "<a href='edit_auto.cgi'>$text{'index_addauto'}</a>");
}
@folders = &mailbox::list_folders();
-if (@filters) {
+if (@filters || &get_global_spamassassin()) {
# Show table of filters
print &ui_form_start("delete.cgi", "post");
@tds = ( "width=5", "width=50%", "width=50%", "width=32" );
[ "", $text{'index_calways'}, $text{'index_aspam'},
@filters > 1 ? ( "" ) : ( ) ],
\@tds);
+ # Delete level
+ $spamlevel = &get_global_spam_delete();
+ if ($spamlevel) {
+ print &ui_columns_row(
+ [ "", &text('index_clevel', $spamlevel),
+ $text{'index_athrow'},
+ @filters > 1 ? ( "" ) : ( ) ],
+ \@tds);
+ }
+ # Delivery path
$spamfile = &get_global_spam_path();
if ($spamfile) {
$folder = &file_to_folder($spamfile, \@folders, 0, 1);
if (@pmrc) {
print "<b>$text{'index_none2'}</b><p>\n";
}
- elsif (&get_global_spamassassin()) {
- $spamfile = &get_global_spam_path();
- if ($spamfile) {
- $folder = &file_to_folder($spamfile, \@folders, 0, 1);
- print "<b>";
- $id = &mailbox::folder_name($folder);
- if ($folder->{'fake'}) {
- print &text('index_none4',
- "<u>$folder->{'name'}</u>");
- }
- else {
- print &text('index_none4',
- "<a href='../mailbox/index.cgi?id=$id'>".
- "$folder->{'name'}</a>");
- }
- print "</b><p>\n";
- }
- else {
- print "<b>$text{'index_none3'}</b><p>\n";
- }
- }
else {
print "<b>$text{'index_none'}</b><p>\n";
}
- shift(@links);
- shift(@links);
print &ui_links_row(\@links);
}
index_move=Move
index_none=You do not have any mail filters defined yet. All email will be delivered to your Inbox.
index_none2=None of your existing Procmail rules are simple enough to display here.
-index_none3=You do not have any mail filters defined yet. All email will be delivered to your Inbox, after spam classification.
-index_none4=You do not have any mail filters defined yet. All email will be deliverted to your Inbox, except spam which will be sent to the folder $1.
-index_none5=You do not have any mail filters defined yet. All email will be deliverted to your Inbox, except spam which will be sent to the file $1.
index_add=Add a new email filter.
index_addauto=Quick automatic reply setup.
index_addfwd=Quick forwarding setup.