aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-11-25 16:10:27 -0500
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-11-25 16:10:27 -0500
commit14848152ffa713811f94b8aa43cabadd0410ecd5 (patch)
treeab3951d5e15edef08cbc3798af948bd5f001edd4
parent1abed39ff3c8d6d9a92e98ea4e2c14a900df983b (diff)
downloadb4-14848152ffa713811f94b8aa43cabadd0410ecd5.tar.gz
Use both To: and Cc: for --cc-trailers
There doesn't seem to be much rhyme or reason for why an address would be in "To" or "Cc", so use both headers when finding Cc: trailer recipients. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 86991e3..3deed18 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -1305,10 +1305,11 @@ class LoreMessage:
trailers = btrailers + self.followup_trailers
if copyccs:
- allccs = email.utils.getaddresses([str(x) for x in self.msg.get_all('cc', [])])
+ alldests = email.utils.getaddresses([str(x) for x in self.msg.get_all('to', [])])
+ alldests += email.utils.getaddresses([str(x) for x in self.msg.get_all('cc', [])])
# Sort by domain name, then local
- allccs.sort(key=lambda x: x[1].find('@') > 0 and x[1].split('@')[1] + x[1].split('@')[0] or x[1])
- for pair in allccs:
+ alldests.sort(key=lambda x: x[1].find('@') > 0 and x[1].split('@')[1] + x[1].split('@')[0] or x[1])
+ for pair in alldests:
found = False
for ftr in trailers:
if ftr[1].lower().find(pair[1].lower()) >= 0: