deltachat / deltachat-core-rust

Delta Chat Rust Core library, used by Android/iOS/desktop apps, bindings and bots 📧
https://delta.chat/en/contribute
Other
659 stars 84 forks source link

Use IMAP APPEND command to upload sync messages with `\Seen` flag #5845

Closed link2xt closed 6 hours ago

link2xt commented 1 month ago

APPEND command allows to pass the list of flags, so \Seen flag can be set immediately. We should do this at least for sync messages.

I also thought about doing this for all messages which don't have other recipients, e.g. messages sent to Saved messages and to groups which don't have any members other than self, but this may result in taking over IMAP connection to upload a very large message with a video and unexpected reordering (currently messages are always sent out in the order they are added into SMTP queue), so better not do it at least for this issue.

Forum discussion is at https://support.delta.chat/t/encrypted-attachments-in-regular-email/2962

There is a related PR for moving sync messages to DeltaChat folder: https://github.com/deltachat/deltachat-core-rust/pull/5755 With IMAP we can even upload directly to DeltaChat.

link2xt commented 1 month ago

Implementation-wise what needs to change is that inbox loop or mvbox loop (depending on where sync messages should go) should produce messages using data from SQL table multi_device_sync and store them on IMAP. And SMTP loop should have this code removed: https://github.com/deltachat/deltachat-core-rust/blob/39ed5879592a70652184967d0f76cee0a623bc59/src/smtp.rs#L517