Skip to content

fix: expire messages also from DeltaChat IMAP subfolders#785

Merged
hpk42 merged 1 commit intomainfrom
hpk/fix_deltachat_folder
Dec 18, 2025
Merged

fix: expire messages also from DeltaChat IMAP subfolders#785
hpk42 merged 1 commit intomainfrom
hpk/fix_deltachat_folder

Conversation

@hpk42
Copy link
Copy Markdown
Contributor

@hpk42 hpk42 commented Dec 18, 2025

this relates to a debugging session with chatmail operators who saw messages on their relay in .DeltaChat folder, see also chatmail/core#7623

@hpk42 hpk42 had a problem deploying to staging-ipv4.testrun.org December 18, 2025 16:45 — with GitHub Actions Error
@hpk42 hpk42 had a problem deploying to staging2.testrun.org December 18, 2025 16:45 — with GitHub Actions Error
@hpk42 hpk42 force-pushed the hpk/fix_deltachat_folder branch from 3ac6d47 to fc9e5cd Compare December 18, 2025 16:48
@hpk42 hpk42 temporarily deployed to staging-ipv4.testrun.org December 18, 2025 16:48 — with GitHub Actions Inactive
@hpk42 hpk42 temporarily deployed to staging2.testrun.org December 18, 2025 16:48 — with GitHub Actions Inactive
@hpk42 hpk42 added the bug Something isn't working label Dec 18, 2025
try:
self.scandir(".")
finally:
os.chdir(old_cwd)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still better in a separate PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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("/"):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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":
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If user logged in with Thunderbird this may also be "Sent" and "Drafts", would be better to just scan everything instead of hardcoding "DeltaChat".

@hpk42 hpk42 merged commit 24e3f33 into main Dec 18, 2025
6 checks passed
@hpk42 hpk42 deleted the hpk/fix_deltachat_folder branch December 18, 2025 22:04
hpk42 added a commit that referenced this pull request Dec 18, 2025
hpk42 added a commit that referenced this pull request Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants