mirror of
https://github.com/spartanz51/tutabridge.git
synced 2026-06-24 10:54:32 +02:00
6aa053e1d616875f9b47249cb2ed0dafca1e5f5b
UIDs were assigned from an in-memory counter that reset to 1 on every bridge restart, so the UID<->mail mapping changed each run and IMAP clients (Thunderbird) re-downloaded the whole mailbox on reconnect. Persist a per-folder monotonic UID in the local store (schema v3): - mails gain a `uid` column; sync_state gains a `next_uid` counter that only ever advances (UIDs are never reused). - The syncer keeps each mail's existing UID and allocates new ones for new mail (oldest-first, so newer mail gets higher UIDs). - refresh_mails uses the persisted UID instead of allocating; messages are ordered by UID. UIDVALIDITY stays constant. Migration v2->v3 drops the cache tables and re-syncs once (encrypted .eml files survive). Live-tested: UID<->mail mapping is identical before and after a restart (range 1..500 unchanged), so clients fetch only the delta instead of re-downloading.
Languages
Rust
89.5%
TypeScript
5.9%
CSS
2.5%
Python
1.2%
Shell
0.7%
Other
0.1%