mirror of
https://git.sr.ht/~rjarry/aerc
synced 2026-03-02 18:23:33 +01:00
Previously, worker action messages did not specify which directory they targeted. Workers implicitly assumed operations applied to the currently selected folder. This assumption breaks when the UI needs to perform operations on a folder different from the one currently open, such as when fetching messages from a background account or handling move/copy operations across folders. Add Directory field to FetchDirectoryContents, FetchDirectoryThreaded, SearchDirectory, FetchMessageHeaders, FetchFullMessages, FetchMessageBodyPart, FetchMessageFlags, DeleteMessages, FlagMessages, AnsweredMessages, and ForwardedMessages. Add Source field to CopyMessages and MoveMessages to specify the origin folder. The message store now populates these fields with its directory name. Each worker backend validates the directory and switches context when necessary. For IMAP, this means issuing a SELECT command when the requested directory differs from the currently selected mailbox. Update the foldermapper middleware to translate the new Directory and Source fields between external and internal folder names in both ProcessAction and PostMessage. In the maildir backend, pass the resolved directory to search and msgInfoFromUid instead of relying on the selected folder state. This ensures FetchMessageHeaders and SearchDirectory operate on the correct directory when it differs from the currently selected one. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Simon Martin <simon@nasilyan.com>