fix: expire messages also from DeltaChat IMAP subfolders#785
Conversation
3ac6d47 to
fc9e5cd
Compare
| try: | ||
| self.scandir(".") | ||
| finally: | ||
| os.chdir(old_cwd) |
There was a problem hiding this comment.
Somewhat related, would be nice to get rid of these chdir calls, they already caused bad error messages when we had disk problems and this chdir on exception does not look reliable to me as it may itself fail: #786
There was a problem hiding this comment.
Still better in a separate PR.
There was a problem hiding this comment.
yes, but not in this PR. let's merge this (if you can agree) and then i'll do a separate PR for using absolute path.
| def fill_mbox(basedir): | ||
| basedir1 = basedir.joinpath("mailbox1@example.org") | ||
| basedir1.mkdir() | ||
| def fill_mbox(basedir1): |
There was a problem hiding this comment.
Maybe rename this basedir1 to mboxdir at least. basedir1 was not descriptive already, but at least it was clear that this avoided conflict with basedir, now this 1 is here for historical reasons only.
| elif message.size > 200000 and message.mtime < cutoff_large_mails: | ||
| # we only remove noticed large files (not unnoticed ones in new/) | ||
| if message.relpath.startswith("cur/"): | ||
| if "cur" in message.relpath.split("/"): |
There was a problem hiding this comment.
Could this check for message.relpath.split("/")[-2] instead? And catch IndexError` I guess because there is no .get method for lists: https://discuss.python.org/t/add-safe-get-method-to-list/32555
| if entry is not None: | ||
| self.messages.append(entry) | ||
|
|
||
| elif relpath == "./.DeltaChat": |
There was a problem hiding this comment.
If user logged in with Thunderbird this may also be "Sent" and "Drafts", would be better to just scan everything instead of hardcoding "DeltaChat".
…code parts according to comments at #785
…code parts according to comments at #785
this relates to a debugging session with chatmail operators who saw messages on their relay in .DeltaChat folder, see also chatmail/core#7623