diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-09-22 17:44:54 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-09-22 17:44:54 -0400 |
commit | c1fe672e39b06f70d27317df2aac4c9e46eaa55f (patch) | |
tree | 391e7b9b54abf99782ac8c083f5ad33fdf599555 | |
parent | 6c215d83473d732cf1208c17a00a8ebc7d7526eb (diff) | |
download | b4-c1fe672e39b06f70d27317df2aac4c9e46eaa55f.tar.gz |
ez: handle full 'Firstname Lastname <email>' parameters
Do the right thing in case we receive addresses with names via cmdline,
e.g.:
b4 send --to 'Firstname Lastname <first.last@example.com>'
Reported-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://msgid.link/YyzPSrTcGliahL+a@google.com
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/ez.py | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -1178,6 +1178,7 @@ def cmd_send(cmdargs: argparse.Namespace) -> None: continue if btr.addr[1] in seen: continue + seen.add(btr.addr[1]) if btr.lname == 'to': todests.append(btr.addr) continue @@ -1187,25 +1188,27 @@ def cmd_send(cmdargs: argparse.Namespace) -> None: if cmdargs.not_me_too: excludes.add(myemail) + tos = set() if cmdargs.to: - todests += [('', x) for x in cmdargs.to] - seen.update(set(cmdargs.to)) + tos.update(cmdargs.to) if config.get('send-series-to'): - for pair in utils.getaddresses([config.get('send-series-to')]): + tos.add(config.get('send-series-to')) + if tos: + for pair in utils.getaddresses(list(tos)): if pair[1] in seen: continue seen.add(pair[1]) - logger.debug('added %s to seen', pair[1]) todests.append(pair) + ccs = set() if cmdargs.cc: - ccdests += [('', x) for x in cmdargs.cc] - seen.update(set(cmdargs.cc)) + ccs.update(cmdargs.cc) if config.get('send-series-cc'): - for pair in utils.getaddresses([config.get('send-series-cc')]): + ccs.add(config.get('send-series-cc')) + if ccs: + for pair in utils.getaddresses(list(ccs)): if pair[1] in seen: continue seen.add(pair[1]) - logger.debug('added %s to seen', pair[1]) ccdests.append(pair) allto = list() |