deltachat-core-rust
deltachat-core-rust copied to clipboard
feat: protect the Date header
Closes #6878 Based on #6867 This depends an a fix #6669, so we may want to postpone merging this until more users have it.
We do not try to delete resent messages anymore. Previously resent messages were distinguised by having duplicate Message-ID, but future Date, but now we need to download the message before we even see the Date. We now move the message to the destination folder but do not fetch it.
It may not be a good idea to delete the duplicate in multi-device setups anyway, because the device which has a message may delete the duplicate of a message the other device missed.
To avoid triggering IMAP move loop described in the comments we now only move the messages from INBOX and Spam folders.
Legacy Python test tests/test_1_online.py::test_resend_message got broken by this.
Resent message is not recognized as duplicate anymore because outer timestamp of just received message is compared to the timestamp of the fetched message:
https://github.com/chatmail/core/blob/adcc8a919cc5f5428cba0c49957fdd0651635b1b/src/imap.rs#L603-L610
This has now broken the test added in c14f45a8f5523c14c2b567c745dd5980387c5207
We will have to use something less suspicious than unix epoch, GMX is unhappy: https://github.com/chatmail/core/issues/6878#issuecomment-2923262681
I have updated this PR to not send 1970 as the date. Should be good enough for review/merging now.
So now the date looks like this Date: Sun, 15 Jun 2025 15:06:40 +0000.
You convert it and get:
date -d 'Sun, 15 Jun 2025 15:06:40 +0000' +%s
1750000000
@link2xt can we merge this, or is there a specific reason why you didn't merge it yet?