diff options
Diffstat (limited to 'alot/db')
-rw-r--r-- | alot/db/utils.py | 31 |
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) |