[Python-modules-commits] [afew] 01/01: New upstream version 1.3.0
Free Ekanayaka
freee at moszumanska.debian.org
Wed Feb 7 10:02:45 UTC 2018
This is an automated email from the git hooks/post-receive script.
freee pushed a commit to branch upstream
in repository afew.
commit b0cc0eabcb72b35700526493cf21949913d9058b
Author: Free Ekanayaka <freee at debian.org>
Date: Wed Feb 7 09:41:04 2018 +0000
New upstream version 1.3.0
---
LICENSE | 15 ++++
PKG-INFO | 10 ++-
README.rst | 4 +-
afew.egg-info/PKG-INFO | 10 ++-
afew.egg-info/SOURCES.txt | 4 +
afew.egg-info/entry_points.txt | 3 +
afew.egg-info/requires.txt | 1 +
afew/Database.py | 21 +----
afew/FilterRegistry.py | 21 +----
afew/MailMover.py | 19 +----
afew/NotmuchSettings.py | 21 +----
afew/Settings.py | 21 +----
afew/__init__.py | 21 +----
afew/__main__.py | 21 +----
afew/commands.py | 22 +----
afew/configparser.py | 21 +----
afew/files.py | 21 +----
afew/filters/ArchiveSentMailsFilter.py | 21 +----
afew/filters/BaseFilter.py | 21 +----
afew/filters/DKIMValidityFilter.py | 39 +++++++++
afew/filters/DMARCReportInspectionFilter.py | 120 ++++++++++++++++++++++++++++
afew/filters/FolderNameFilter.py | 21 +----
afew/filters/HeaderMatchingFilter.py | 21 +----
afew/filters/InboxFilter.py | 20 +----
afew/filters/KillThreadsFilter.py | 21 +----
afew/filters/ListMailsFilter.py | 21 +----
afew/filters/MeFilter.py | 33 ++++++++
afew/filters/SentMailsFilter.py | 21 +----
afew/filters/SpamFilter.py | 21 +----
afew/filters/__init__.py | 21 +----
afew/main.py | 21 +----
afew/tests/__init__.py | 15 +---
afew/tests/test_settings.py | 19 ++---
afew/utils.py | 21 +----
afew/version.py | 2 +-
docs/source/conf.py | 16 +---
docs/source/move_mode.rst | 22 ++++-
setup.py | 28 +++----
38 files changed, 353 insertions(+), 448 deletions(-)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..1162e10
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,15 @@
+ISC License
+
+Copyright (c) 2017, afewmail project
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/PKG-INFO b/PKG-INFO
index f00c196..ac329ad 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,13 +1,15 @@
Metadata-Version: 1.1
Name: afew
-Version: 1.2.0
-Summary: UNKNOWN
-Home-page: UNKNOWN
+Version: 1.3.0
+Summary: An initial tagging script for notmuch mail
+Home-page: https://github.com/afewmail/afew
Author: UNKNOWN
Author-email: UNKNOWN
-License: UNKNOWN
+License: ISC
+Description-Content-Type: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
+Classifier: License :: OSI Approved :: ISC License (ISCL)
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
diff --git a/README.rst b/README.rst
index b0b25b0..dd8d1ff 100644
--- a/README.rst
+++ b/README.rst
@@ -240,6 +240,6 @@ Have fun :)
.. |GithubTag| image:: https://img.shields.io/github/tag/afewmail/afew.svg
- :target: https://travis-ci.org/afewmail/afew
-.. |TravisStatus| image:: https://travis-ci.org/afewmail/afew.svg?branch=master
:target: https://github.com/afewmail/afew/releases
+.. |TravisStatus| image:: https://travis-ci.org/afewmail/afew.svg?branch=master
+ :target: https://travis-ci.org/afewmail/afew
diff --git a/afew.egg-info/PKG-INFO b/afew.egg-info/PKG-INFO
index f00c196..ac329ad 100644
--- a/afew.egg-info/PKG-INFO
+++ b/afew.egg-info/PKG-INFO
@@ -1,13 +1,15 @@
Metadata-Version: 1.1
Name: afew
-Version: 1.2.0
-Summary: UNKNOWN
-Home-page: UNKNOWN
+Version: 1.3.0
+Summary: An initial tagging script for notmuch mail
+Home-page: https://github.com/afewmail/afew
Author: UNKNOWN
Author-email: UNKNOWN
-License: UNKNOWN
+License: ISC
+Description-Content-Type: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
+Classifier: License :: OSI Approved :: ISC License (ISCL)
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
diff --git a/afew.egg-info/SOURCES.txt b/afew.egg-info/SOURCES.txt
index 2fd7d9e..19e6d4f 100644
--- a/afew.egg-info/SOURCES.txt
+++ b/afew.egg-info/SOURCES.txt
@@ -1,5 +1,6 @@
.gitignore
.travis.yml
+LICENSE
NEWS.md
README.rst
setup.py
@@ -25,11 +26,14 @@ afew.egg-info/top_level.txt
afew/defaults/afew.config
afew/filters/ArchiveSentMailsFilter.py
afew/filters/BaseFilter.py
+afew/filters/DKIMValidityFilter.py
+afew/filters/DMARCReportInspectionFilter.py
afew/filters/FolderNameFilter.py
afew/filters/HeaderMatchingFilter.py
afew/filters/InboxFilter.py
afew/filters/KillThreadsFilter.py
afew/filters/ListMailsFilter.py
+afew/filters/MeFilter.py
afew/filters/SentMailsFilter.py
afew/filters/SpamFilter.py
afew/filters/__init__.py
diff --git a/afew.egg-info/entry_points.txt b/afew.egg-info/entry_points.txt
index 1b0c837..cf518f3 100644
--- a/afew.egg-info/entry_points.txt
+++ b/afew.egg-info/entry_points.txt
@@ -1,11 +1,14 @@
[afew.filter]
ArchiveSentMailsFilter = afew.filters.ArchiveSentMailsFilter:ArchiveSentMailsFilter
+DKIMValidityFilter = afew.filters.DKIMValidityFilter:DKIMValidityFilter
+DMARCReportInspectionFilter = afew.filters.DMARCReportInspectionFilter:DMARCReportInspectionFilter
Filter = afew.filters.BaseFilter:Filter
FolderNameFilter = afew.filters.FolderNameFilter:FolderNameFilter
HeaderMatchingFilter = afew.filters.HeaderMatchingFilter:HeaderMatchingFilter
InboxFilter = afew.filters.InboxFilter:InboxFilter
KillThreadsFilter = afew.filters.KillThreadsFilter:KillThreadsFilter
ListMailsFilter = afew.filters.ListMailsFilter:ListMailsFilter
+MeFilter = afew.filters.MeFilter:MeFilter
SentMailsFilter = afew.filters.SentMailsFilter:SentMailsFilter
SpamFilter = afew.filters.SpamFilter:SpamFilter
diff --git a/afew.egg-info/requires.txt b/afew.egg-info/requires.txt
index faa6a6f..4cc6fdc 100644
--- a/afew.egg-info/requires.txt
+++ b/afew.egg-info/requires.txt
@@ -1,2 +1,3 @@
notmuch
chardet
+dkimpy
diff --git a/afew/Database.py b/afew/Database.py
index 59b9a6a..a3807ab 100644
--- a/afew/Database.py
+++ b/afew/Database.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
import time
import logging
diff --git a/afew/FilterRegistry.py b/afew/FilterRegistry.py
index ef77398..712ef1d 100644
--- a/afew/FilterRegistry.py
+++ b/afew/FilterRegistry.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
import pkg_resources
diff --git a/afew/MailMover.py b/afew/MailMover.py
index 718e4d8..6e55a56 100644
--- a/afew/MailMover.py
+++ b/afew/MailMover.py
@@ -1,21 +1,6 @@
-# coding=utf-8
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) dtk <dtk at gmx.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-
import notmuch
import logging
diff --git a/afew/NotmuchSettings.py b/afew/NotmuchSettings.py
index 83b78e6..17fa8af 100644
--- a/afew/NotmuchSettings.py
+++ b/afew/NotmuchSettings.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
import os
diff --git a/afew/Settings.py b/afew/Settings.py
index ed3edc5..c3caa3d 100644
--- a/afew/Settings.py
+++ b/afew/Settings.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
import os
import re
diff --git a/afew/__init__.py b/afew/__init__.py
index 0b82a54..ba3759b 100644
--- a/afew/__init__.py
+++ b/afew/__init__.py
@@ -1,18 +1,5 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
diff --git a/afew/__main__.py b/afew/__main__.py
index a5b71a5..7aaca0e 100644
--- a/afew/__main__.py
+++ b/afew/__main__.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Lucas Hoffmann
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
from afew.commands import main
main()
diff --git a/afew/commands.py b/afew/commands.py
index 4210ac9..64f9f57 100644
--- a/afew/commands.py
+++ b/afew/commands.py
@@ -1,22 +1,8 @@
-#!/usr/bin/env python
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
import glob
import sys
diff --git a/afew/configparser.py b/afew/configparser.py
index a82c79b..d7b9afe 100644
--- a/afew/configparser.py
+++ b/afew/configparser.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
try:
# py3k
diff --git a/afew/files.py b/afew/files.py
index b847860..32ac398 100644
--- a/afew/files.py
+++ b/afew/files.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
import os
import re
diff --git a/afew/filters/ArchiveSentMailsFilter.py b/afew/filters/ArchiveSentMailsFilter.py
index 351e2e9..eeb4810 100644
--- a/afew/filters/ArchiveSentMailsFilter.py
+++ b/afew/filters/ArchiveSentMailsFilter.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
from ..filters.SentMailsFilter import SentMailsFilter
from ..NotmuchSettings import get_notmuch_new_tags
diff --git a/afew/filters/BaseFilter.py b/afew/filters/BaseFilter.py
index 3e41b00..01d0a4c 100644
--- a/afew/filters/BaseFilter.py
+++ b/afew/filters/BaseFilter.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
import collections
import logging
diff --git a/afew/filters/DKIMValidityFilter.py b/afew/filters/DKIMValidityFilter.py
new file mode 100644
index 0000000..76f8fcb
--- /dev/null
+++ b/afew/filters/DKIMValidityFilter.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
+# Copyright (c) Amadeusz Zolnowski <aidecoe at aidecoe.name>
+
+from __future__ import print_function, absolute_import, unicode_literals
+
+import dkim
+
+from .BaseFilter import Filter
+
+
+def verify_dkim(path):
+ '''
+ Verify DKIM signature of an e-mail file.
+
+ :param path: Path to the e-mail file.
+ :returns: Whether DKIM signature is valid or not.
+ '''
+ with open(path, 'rb') as message_file:
+ message_bytes = message_file.read()
+
+ return dkim.verify(message_bytes)
+
+
+class DKIMValidityFilter(Filter):
+ '''
+ Verifies DKIM signature of an e-mail which has DKIM header.
+ '''
+ message = 'Verify DKIM signature'
+ header = 'DKIM-Signature'
+
+ def __init__(self, database, ok_tag='dkim-ok', fail_tag='dkim-fail'):
+ super(DKIMValidityFilter, self).__init__(database)
+ self.dkim_tag = {True: ok_tag, False: fail_tag}
+
+ def handle_message(self, message):
+ if message.get_header(self.header):
+ dkim_ok = all(map(verify_dkim, message.get_filenames()))
+ self.add_tags(message, self.dkim_tag[dkim_ok])
diff --git a/afew/filters/DMARCReportInspectionFilter.py b/afew/filters/DMARCReportInspectionFilter.py
new file mode 100644
index 0000000..9e672df
--- /dev/null
+++ b/afew/filters/DMARCReportInspectionFilter.py
@@ -0,0 +1,120 @@
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
+# Copyright (c) Amadeusz Zolnowski <aidecoe at aidecoe.name>
+
+from __future__ import print_function, absolute_import, unicode_literals
+
+import re
+import tempfile
+import xml.etree.ElementTree as ET
+import zipfile
+
+from .BaseFilter import Filter
+
+
+class ReportFilesIterator(object):
+ '''
+ Iterator over DMARC reports files attached to the e-mail either directly or
+ in ZIP files.
+
+ Returns content of each document file (as bytes, not as string) which needs
+ to be decoded from charset encoding.
+ '''
+ def __init__(self, message):
+ self.message = message
+
+ def __iter__(self):
+ for part in self.message.get_message_parts():
+ if part.get_content_type() == 'application/zip':
+ with tempfile.TemporaryFile(suffix='.zip') as file:
+ file.write(part.get_payload(decode=True))
+ with zipfile.ZipFile(file) as zip_file:
+ for member_file in zip_file.infolist():
+ if member_file.filename.endswith('.xml'):
+ yield zip_file.read(member_file)
+ elif part.get_content_type() == 'application/xml':
+ yield part.get_payload(decode=True)
+
+
+def and_dict(dict1, dict2):
+ '''
+ Apply logical conjunction between values of dictionaries of the same keys.
+
+ Keys set must be identical in both dictionaries. Otherwise KeyError
+ exception is raised.
+
+ :param dict1: Dictionary of bool values.
+ :param dict2: Dictionary of bool values.
+ :returns: A dictionary with the same set of keys but with modified values.
+ '''
+ dict3 = {}
+ for key in dict1.keys():
+ dict3[key] = dict1[key] & dict2.get(key, False)
+ return dict3
+
+
+def has_failed(node):
+ '''
+ Check whether status is "failed".
+
+ To avoid false positives check whether status is one of "pass" or "none".
+
+ :param node: XML node holding status as text.
+ :returns: Whether the status is reported as "failed".
+ '''
+ return (node.text.strip() not in ['pass', 'none'])
+
+
+def read_auth_results(document):
+ '''
+ Parse DMARC document.
+
+ Look for results for DKIM and SPF. If there's more than one record, return
+ `True` only and only if all of the records of particular type (DKIM or SPF)
+ are "pass".
+
+ :returns: Results as a dictionary where keys are: `dkim` and `spf` and
+ values are boolean values.
+ '''
+ results = {'dkim': True, 'spf': True}
+ root = ET.fromstring(document)
+ for record in root.findall('record'):
+ auth_results = record.find('auth_results')
+ dkim = auth_results.find('dkim').find('result')
+ spf = auth_results.find('spf').find('result')
+ results['dkim'] &= not has_failed(dkim)
+ results['spf'] &= not has_failed(spf)
+
+ return results
+
+
+class DMARCReportInspectionFilter(Filter):
+ '''
+ Inspect DMARC reports for DKIM and SPF status.
+ '''
+ def __init__(self, # pylint: disable=too-many-arguments
+ database,
+ dkim_ok_tag='dmarc/dkim-ok',
+ dkim_fail_tag='dmarc/dkim-fail',
+ spf_ok_tag='dmarc/spf-ok',
+ spf_fail_tag='dmarc/spf-fail'):
+ super(DMARCReportInspectionFilter, self).__init__(database)
+ self.dkim_tag = {True: dkim_ok_tag, False: dkim_fail_tag}
+ self.spf_tag = {True: spf_ok_tag, False: spf_fail_tag}
+ self.dmarc_subject = re.compile(r'^report domain:',
+ flags=re.IGNORECASE)
+
+ def handle_message(self, message):
+ if not self.dmarc_subject.match(message.get_header('Subject')):
+ return
+
+ auth_results = {'dkim': True, 'spf': True}
+
+ for file_content in ReportFilesIterator(message):
+ document = file_content.decode('UTF-8')
+ auth_results = and_dict(auth_results, read_auth_results(document))
+
+ self.add_tags(message,
+ 'dmarc',
+ self.dkim_tag[auth_results['dkim']],
+ self.spf_tag[auth_results['spf']])
diff --git a/afew/filters/FolderNameFilter.py b/afew/filters/FolderNameFilter.py
index f54a8d8..956b68d 100644
--- a/afew/filters/FolderNameFilter.py
+++ b/afew/filters/FolderNameFilter.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) dtk <dtk at gmx.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
from .BaseFilter import Filter
from ..NotmuchSettings import notmuch_settings
diff --git a/afew/filters/HeaderMatchingFilter.py b/afew/filters/HeaderMatchingFilter.py
index ef77d66..6dd4626 100644
--- a/afew/filters/HeaderMatchingFilter.py
+++ b/afew/filters/HeaderMatchingFilter.py
@@ -1,24 +1,11 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) 2012 Justus Winter <4winter at informatik.uni-hamburg.de>
# Copyright (c) 2013 Patrick Gerken <do3cc at patrick-gerken.de>
# Copyright (c) 2013 Patrick Totzke <patricktotzke at gmail.com>
# Copyright (c) 2014 Lars Kellogg-Stedman <lars at redhat.com>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
from .BaseFilter import Filter
diff --git a/afew/filters/InboxFilter.py b/afew/filters/InboxFilter.py
index d6ce58b..2b0d0b0 100644
--- a/afew/filters/InboxFilter.py
+++ b/afew/filters/InboxFilter.py
@@ -1,21 +1,7 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+from __future__ import print_function, absolute_import, unicode_literals
from .BaseFilter import Filter
from ..NotmuchSettings import get_notmuch_new_tags, get_notmuch_new_query
diff --git a/afew/filters/KillThreadsFilter.py b/afew/filters/KillThreadsFilter.py
index d7f73c1..e9732d7 100644
--- a/afew/filters/KillThreadsFilter.py
+++ b/afew/filters/KillThreadsFilter.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
from .BaseFilter import Filter
diff --git a/afew/filters/ListMailsFilter.py b/afew/filters/ListMailsFilter.py
index 15d79ed..fec3e21 100644
--- a/afew/filters/ListMailsFilter.py
+++ b/afew/filters/ListMailsFilter.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
from .HeaderMatchingFilter import HeaderMatchingFilter
diff --git a/afew/filters/MeFilter.py b/afew/filters/MeFilter.py
new file mode 100644
index 0000000..4201615
--- /dev/null
+++ b/afew/filters/MeFilter.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
+# Copyright (c) Amadeusz Zolnowski <aidecoe at aidecoe.name>
+
+from __future__ import print_function, absolute_import, unicode_literals
+
+import re
+
+from ..utils import filter_compat
+from .BaseFilter import Filter
+from ..NotmuchSettings import notmuch_settings
+
+
+class MeFilter(Filter):
+ message = 'Tagging all mails sent directly to myself'
+ _bare_email_re = re.compile(r"[^<]*<(?P<email>[^@<>]+@[^@<>]+)>")
+
+ def __init__(self, database, me_tag='to-me'):
+ super(MeFilter, self).__init__(database)
+
+ my_addresses = set()
+ my_addresses.add(notmuch_settings.get('user', 'primary_email'))
+ if notmuch_settings.has_option('user', 'other_email'):
+ other_emails = notmuch_settings.get('user', 'other_email').split(';')
+ my_addresses.update(filter_compat(None, other_emails))
+
+ self.query = ' OR '.join('to:"%s"' % address
+ for address in my_addresses)
+
+ self.me_tag = me_tag
+
+ def handle_message(self, message):
+ self.add_tags(message, self.me_tag)
diff --git a/afew/filters/SentMailsFilter.py b/afew/filters/SentMailsFilter.py
index e7c746b..cf5d27f 100644
--- a/afew/filters/SentMailsFilter.py
+++ b/afew/filters/SentMailsFilter.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
import re
diff --git a/afew/filters/SpamFilter.py b/afew/filters/SpamFilter.py
index 631dc63..1e39315 100644
--- a/afew/filters/SpamFilter.py
+++ b/afew/filters/SpamFilter.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
from .HeaderMatchingFilter import HeaderMatchingFilter
diff --git a/afew/filters/__init__.py b/afew/filters/__init__.py
index 1b6ebf9..d3011d1 100644
--- a/afew/filters/__init__.py
+++ b/afew/filters/__init__.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter at informatik.uni-hamburg.de>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
+
+from __future__ import print_function, absolute_import, unicode_literals
import sys
import os
diff --git a/afew/main.py b/afew/main.py
index ddc8470..79325d5 100644
--- a/afew/main.py
+++ b/afew/main.py
@@ -1,21 +1,8 @@
-# coding=utf-8
-from __future__ import print_function, absolute_import, unicode_literals
-
-#
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: ISC
... 257 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/afew.git
More information about the Python-modules-commits
mailing list