Skip to content

Commit

Permalink
Remove archiving option from DMARCReportInspectionFilter
Browse files Browse the repository at this point in the history
This can be achieved with a regular filter. There's no need to duplicate
this functionality in every filter.
  • Loading branch information
aidecoe authored and andir committed Dec 4, 2017
1 parent 9016fcd commit 8a28657
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions afew/filters/DMARCReportInspectionFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import zipfile

from .BaseFilter import Filter
from ..NotmuchSettings import get_notmuch_new_tags


class ReportFilesIterator(object):
Expand Down Expand Up @@ -95,7 +94,6 @@ class DMARCReportInspectionFilter(Filter):
'''
def __init__(self, # pylint: disable=too-many-arguments
database,
archive_passed='on',
dkim_ok_tag='dmarc-dkim-ok',
dkim_fail_tag='dmarc-dkim-fail',
spf_ok_tag='dmarc-spf-ok',
Expand All @@ -105,8 +103,6 @@ def __init__(self, # pylint: disable=too-many-arguments
self.spf_tag = {True: spf_ok_tag, False: spf_fail_tag}
self.dmarc_subject = re.compile(r'^report domain:',
flags=re.IGNORECASE)
self.archive_passed = archive_passed.lower() in ['on', '1', 't',
'true', 'yes']

def handle_message(self, message):
if not self.dmarc_subject.match(message.get_header('Subject')):
Expand All @@ -122,6 +118,3 @@ def handle_message(self, message):
'dmarc',
self.dkim_tag[auth_results['dkim']],
self.spf_tag[auth_results['spf']])

if self.archive_passed and all(auth_results.values()):
self.remove_tags(message, *get_notmuch_new_tags())

0 comments on commit 8a28657

Please sign in to comment.