ref: f77d7c2c3d578ae5a724e1e8b91656304dde75d0 aerc/worker d---------
Handle external message deletions
Handle incoming emails gracefully
worker/imap: use the IMAP connection from a single goroutine

Unfortunately, the IMAP protocol hasn't been designed to be used from multiple
goroutines at the same time. For instance, if you fetch twice the same message
from two different goroutines, it's not possible to tell whether the response
is for one receiver or the other. For this reason, go-imap clients aren't safe
to use from multiple goroutines.

This commit changes the IMAP workers to be synchronous again (a command is
executed only after the previous one has completed). To use IMAP from different
threads, popular clients (e.g. Thunderbird) typically open multiple
worker/types: fix Worker.Callbacks race condition

Worker.Process* functions were called in different goroutines than
Worker.Post*. Protect the map with a mutex. Also make the map unexported to
prevent external unprotected accesses.

Worker.Process* functions used to delete items from the map. However they
didn't delete the element they retrieved: callbacks[msg.InResponseTo()] was
read while callbacks[msg] was deleted. I'm not sure I understand why. I tried
to delete the element that was accessed - but this broke everything (UI froze
at "Connecting..."). I don't believe any elements were actually removed from
the map, so the new code just doesn't remove anything.
Make message viewer real, part two
Rename FetchMessageBodies to FetchFullMessages
Make the message viewer real, part one
Don't parse mail in worker; send a reader instead
Pull BodyStructure up from IMAP worker
Add body fetching support code
Implement :delete-message
Display message subjects in message list
Implement message store side of message fetching
Fetch valid UIDs from server after opening dir
Add loading spinner
Add name to DirectoryInfo messages
Issue IMAP SELECT command
67d14977 — Markus Ongyerth 2 years ago
fallthrough in worker selection
Tidy up list.go
Refactoring; consume listing response