Skip to content

Download new messages based on Date on UID validity change #5774

@link2xt

Description

@link2xt

When UID validity changes, Delta Chat schedules resync to update UIDs stored in the imap table:
https://github.com/deltachat/deltachat-core-rust/blob/9996c2db80e0ebafb2d44b8777ed75c9bf355388/src/imap.rs#L836
However, it does not download any messages that arrived between previous fetch and detecting that UID validity changed.

When UID validity change is detected, Delta Chat should download all messages that have Date higher than the highest message timestamp observed so far.

I thought about using INTERNALDATE, but this can be changed if admins carelessly copy mailbox to a new server without preserving timestamps and all archived messages become "new". This is likely to happen together with UID validity change. Even if this is quickly detected, Delta Chat clients would have already downloaded all messages cluttering the chatlist and wasting traffic.

Currently resync_folders happens on the INBOX loop, this is not a place to download messages e.g. from Delta Chat folder, so first of all resync_request variable should be removed and resyncing UIDs should be integrated directly into the fetch procedure. When folder is fetched and UID validity is known to have changed since last fetch, all messages should be prefetched, UIDs of known messages updated because of known Message-ID and new messages are downloaded based on Date.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions