Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: check UIDNEXT with a STATUS command before going IDLE
This prevents accidentally going IDLE when the last new message has arrived while the folder was closed. For example, this happened in some tests: 1. INBOX is selected to fetch, move and delete messages. 2. One of the messages is deleted. 3. INBOX is closed to expunge the message. 4. A new message arrives. 5. INBOX is selected with (CONDSTORE) to sync flags. 6. Delta Chat goes into IDLE without downloading the new message. To determine that a new message has arrived we need to notice that UIDNEXT has advanced when selecting the folder. However, some servers such as Winmail Pro Mail Server 5.1.0616 do not return UIDNEXT in response to SELECT command. To avoid interdependencies with the code SELECTing the folder and having to implement STATUS fallback after each SELECT even when we may not want to go IDLE due to interrupt or unsolicited EXISTS, we simply call STATUS unconditionally before IDLE.
- Loading branch information