public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH] fix #2228: automatically deliver/delete on whitelist/blacklist
Date: Tue, 30 Mar 2021 17:05:47 +0200	[thread overview]
Message-ID: <20210330150547.21333-1-t.lamprecht@proxmox.com> (raw)

If a user chooses to blacklist a specific sender of a mail, the mail
is highly probably undesired too, so delete it in that case.

The reverse should hold for white listing a mail's sender, deliver it
in that case.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---

The bug report talked about doing this opt-out, but I really do not see when
one would think along the lines of "that sender is always spam, blacklist them
but keep that specific mail" so just do it unconditionally.

 src/PMG/API2/Quarantine.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PMG/API2/Quarantine.pm b/src/PMG/API2/Quarantine.pm
index 848ae8e..2fa1bb4 100644
--- a/src/PMG/API2/Quarantine.pm
+++ b/src/PMG/API2/Quarantine.pm
@@ -1228,8 +1228,10 @@ __PACKAGE__->register_method ({
 
 	    if ($action eq 'whitelist') {
 		PMG::Quarantine::add_to_blackwhite($dbh, $ref->{pmail}, 'WL', [ $sender ]);
+		PMG::Quarantine::deliver_quarantined_mail($dbh, $ref, $ref->{receiver} // $ref->{pmail});
 	    } elsif ($action eq 'blacklist') {
 		PMG::Quarantine::add_to_blackwhite($dbh, $ref->{pmail}, 'BL', [ $sender ]);
+		PMG::Quarantine::delete_quarantined_mail($dbh, $ref);
 	    } elsif ($action eq 'deliver') {
 		PMG::Quarantine::deliver_quarantined_mail($dbh, $ref, $ref->{receiver} // $ref->{pmail});
 	    } elsif ($action eq 'delete') {
-- 
2.20.1





             reply	other threads:[~2021-03-30 15:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 15:05 Thomas Lamprecht [this message]
2021-03-31 11:44 ` [pmg-devel] applied: " Stoiko Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210330150547.21333-1-t.lamprecht@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal