diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-11-30 17:39:52 -0500 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-11-30 17:39:52 -0500 |
commit | 20722ba22162d1ddeae3615b3010b8311dd9cf42 (patch) | |
tree | a2f770af2c025114242569a721470a6e75431c43 /b4/mbox.py | |
parent | 807a4e1c96582968b722072dab28abf9fc1dc873 (diff) | |
download | b4-20722ba22162d1ddeae3615b3010b8311dd9cf42.tar.gz |
If using -m, reduce local mbox to strict thread
When passing a local mbox, don't assume that it is going to contain a
strict thread already -- it can be just a local mailbox via something
like mbsync. This grabs actual thread from the mailbox before looking at
individual messages.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/mbox.py')
-rw-r--r-- | b4/mbox.py | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -511,7 +511,14 @@ def main(cmdargs): return else: if os.path.exists(cmdargs.localmbox): - threadmbox = cmdargs.localmbox + msgid = b4.get_msgid(cmdargs) + if os.path.isdir(cmdargs.localmbox): + in_mbx = mailbox.Maildir(cmdargs.localmbox) + else: + in_mbx = mailbox.mbox(cmdargs.localmbox) + out_mbx = mailbox.mbox(savefile) + b4.save_strict_thread(in_mbx, out_mbx, msgid) + threadmbox = savefile else: logger.critical('Mailbox %s does not exist', cmdargs.localmbox) os.unlink(savefile) |