aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--b4/__init__.py11
-rw-r--r--b4/mbox.py4
-rw-r--r--b4/pr.py4
3 files changed, 12 insertions, 7 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 4d27aea..17fae0e 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -2336,11 +2336,16 @@ def git_branch_contains(gitdir, commit_id):
return lines
-def format_addrs(pairs):
+def format_addrs(pairs, clean=True):
addrs = set()
for pair in pairs:
- # Remove any quoted-printable header junk from the name
- addrs.add(email.utils.formataddr((LoreMessage.clean_header(pair[0]), LoreMessage.clean_header(pair[1]))))
+ pair = list(pair)
+ if pair[0] == pair[1]:
+ pair[0] = ''
+ if clean:
+ # Remove any quoted-printable header junk from the name
+ pair[0] = LoreMessage.clean_header(pair[0])
+ addrs.add(email.utils.formataddr(pair)) # noqa
return ', '.join(addrs)
diff --git a/b4/mbox.py b/b4/mbox.py
index 38b2f0e..d998380 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -299,8 +299,8 @@ def thanks_record_am(lser, cherrypick=None):
'subject': lmsg.full_subject,
'fromname': lmsg.fromname,
'fromemail': lmsg.fromemail,
- 'to': b4.format_addrs(allto),
- 'cc': b4.format_addrs(allcc),
+ 'to': b4.format_addrs(allto, clean=False),
+ 'cc': b4.format_addrs(allcc, clean=False),
'references': b4.LoreMessage.clean_header(lmsg.msg['References']),
'sentdate': b4.LoreMessage.clean_header(lmsg.msg['Date']),
'quote': b4.make_quote(lmsg.body, maxlines=5),
diff --git a/b4/pr.py b/b4/pr.py
index b7ed9e1..d8833a9 100644
--- a/b4/pr.py
+++ b/b4/pr.py
@@ -213,8 +213,8 @@ def thanks_record_pr(lmsg):
'subject': lmsg.full_subject,
'fromname': lmsg.fromname,
'fromemail': lmsg.fromemail,
- 'to': b4.format_addrs(allto),
- 'cc': b4.format_addrs(allcc),
+ 'to': b4.format_addrs(allto, clean=False),
+ 'cc': b4.format_addrs(allcc, clean=False),
'references': b4.LoreMessage.clean_header(lmsg.msg['References']),
'remote': lmsg.pr_repo,
'ref': lmsg.pr_ref,