Post #3197859
2026-02-21 18:41 UTC
@Migueldeicaza@mastodon.social It doesn't model the IMAP flow correctly.
When, e.g., you call `uidSearch`, the library is consuming *all* responses until it receives the corresponding tagged response—dropping the other responses. This means:
1. Commands can't run concurrently. (Responses from concurrent commands are interleaved.)
2. You can't process unprompted untagged responses from the server. (These are an important for learning about new messages and deletions without polling)
Replies (3)
-
@Migueldeicaza@mastodon.social 2026-02-21 18:43
@mdiep@mas.to thanks! Will address!
-
@mdiep@mas.to 2026-02-21 18:46
@Migueldeicaza@mastodon.social e.g., you might have something like this: C: A1 FETCH 1:100 (BODY[]) C: A2 STORE 5 +FLAGS (\Seen) S: * 42 EXISTS S: * 5 FETCH (FLAGS (\Seen \Recent)) S: A2 OK STORE completed S: A1 OK FETCH completed The `* 42 EXISTS` is the server telling you a new message arrived. The `* 5 FETCH` is from `A2`, which completes before `A1`. Ideally, you'll also handle pipelining: some commands are safe to send concurrently and some are not. It's best to only use UIDs—never sequence numbers.
-
@Migueldeicaza@mastodon.social 2026-02-21 21:26
@mdiep@mas.to Adding the untagged is not hard, doing so now - those exist in the original MailKit. Then going to explore the pipelining. Thanks!