mirror of
https://github.com/chatmail/core.git
synced 2026-04-05 23:22:11 +03:00
`imap` table maps Message-IDs to UIDs on the server. `dc_receive_imf` no longer gets the UID of the message as an argument and does not insert the folder and UID of the message into the `msgs` table. `server_folder` and `server_uid` columns in `msgs` table are deprecated. MoveMsg and DeleteMsgOnImap jobs are removed. Now messages are moved and deleted only in the `fetch_move_delete` procedure that consults the `target` column of the `imap` table to determine where the message should go. Where the message should go is determined after prefetching by the `imap::target_folder()` procedure. Messages are only downloaded once they reach their target folder to avoid race conditions in multidevice setting, such as: 1. One device trying to FETCH the message while the other tries to MOVE it. 2. One device marking the message as \Seen in the Inbox while the other has already copied unseen message to the Movebox and is going to delete the \Seen message in the Inbox. 3. Device downloads the message from the Inbox while there are newer messages in the Movebox placed there by the other device, thus processing the messages out of order.