summaryrefslogtreecommitdiff
path: root/alot/db
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-03-05 10:06:22 +0100
committerAnton Khirnov <anton@khirnov.net>2020-03-05 10:06:22 +0100
commit6e159d42ea4051b4997f55b06c3775c1ebab0f77 (patch)
treedb6d7f04baadd86312cf4b3c1c4396b6826261e2 /alot/db
parent46bb3a3efe8614478559a9594880367a8a419e53 (diff)
db/utils: move clear_my_address/ensure_unique_address to their usage place
They are only used in a single file, so there is no point in keeping them elsewhere.
Diffstat (limited to 'alot/db')
-rw-r--r--alot/db/utils.py31
1 files changed, 0 insertions, 31 deletions
diff --git a/alot/db/utils.py b/alot/db/utils.py
index 0a7d1f59..a2101e9d 100644
--- a/alot/db/utils.py
+++ b/alot/db/utils.py
@@ -37,34 +37,3 @@ def is_subdir_of(subpath, superpath):
# return true, if the common prefix of both is equal to directory
# e.g. /a/b/c/d.rst and directory is /a/b, the common prefix is /a/b
return os.path.commonprefix([subpath, superpath]) == superpath
-
-
-def clear_my_address(my_account, value):
- """return recipient header without the addresses in my_account
-
- :param my_account: my account
- :type my_account: :class:`Account`
- :param value: a list of recipient or sender strings (with or without
- real names as taken from email headers)
- :type value: list(str)
- :returns: a new, potentially shortend list
- :rtype: list(str)
- """
- new_value = []
- for name, address in email.utils.getaddresses(value):
- if not my_account.matches_address(address):
- new_value.append(formataddr((name, address)))
- return new_value
-
-
-def ensure_unique_address(recipients):
- """
- clean up a list of name,address pairs so that
- no address appears multiple times.
- """
- res = dict()
- for name, address in email.utils.getaddresses(recipients):
- res[address] = name
- logging.debug(res)
- urecipients = [formataddr((n, a)) for a, n in res.items()]
- return sorted(urecipients)