diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2017-01-25 09:21:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-25 09:21:19 +0000 |
commit | 91b09336cda1f151e1aa8c5b94347de7f892de74 (patch) | |
tree | 2393a1ca20caebbb695bfaa3e2ece1e6649c3570 /alot | |
parent | c67a62ec0804a588df577360e80922e2a2ffb2ef (diff) | |
parent | 30509910985abb1e0018a9e6b2d6973d1894ba9c (diff) |
Merge pull request #997 from lucc/tests/comma
Add tests for reply header creation
Diffstat (limited to 'alot')
-rw-r--r-- | alot/commands/thread.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 6dd4f248..79fb8415 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -231,19 +231,6 @@ class ReplyCommand(Command): my_addresses, mail.get_all('Cc', [])) envelope.add('Cc', decode_header(', '.join(cc))) - 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 getaddresses(recipients): - res[address] = name - urecipients = ['"{}" <{}>'.format(n, a) if n != '' - else a - for a, n in res.iteritems()] - return sorted(urecipients) - to = ', '.join(ensure_unique_address(recipients)) logging.debug('reply to: %s', to) @@ -310,6 +297,20 @@ class ReplyCommand(Command): new_value.append(address) return new_value + @staticmethod + 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 getaddresses(recipients): + res[address] = name + urecipients = ['"{}" <{}>'.format(n, a) if n != '' + else a + for a, n in res.iteritems()] + return sorted(urecipients) + @registerCommand(MODE, 'forward', arguments=[ (['--attach'], {'action': 'store_true', 'help': 'attach original mail'}), |