summaryrefslogtreecommitdiff
path: root/worker/maildir/worker.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-06-01 19:24:53 -0500
committerRobin Jarry <robin@jarry.cc>2022-06-07 16:19:23 +0200
commit8b6f9719a84fa0ee31d84b9e864495af4f166d92 (patch)
tree8c5bc108673cce4a33e124c20855e633acabd667 /worker/maildir/worker.go
parent4985d1bab8996a995bd93abe120835320e3c7d82 (diff)
downloadaerc-8b6f9719a84fa0ee31d84b9e864495af4f166d92.zip
dirlist: update RUE counts for imap/maildir on move|copy|delete|archive
When moving/copying/deleting/archiving a message in imap, the RUE counts displayed in the dirlist would not update properly. Maildir has (had) an implementation that recounts the entire directory and updates the DirectoryInfo after one of these actions. This patch implements a more efficient method of updating, and also enables it to apply to IMAP without any additional requests. Upon completion of the action, the counts are manually updated with the count of messages in the action and recent and/or unseen states of those messages. This is more efficient for maildir, because we aren't counting everything in the store. For IMAP, we get the updates for free because we are only performing the update after confirmation from the server that the action has happened. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/maildir/worker.go')
-rw-r--r--worker/maildir/worker.go17
1 files changed, 4 insertions, 13 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index d3de844..0a51ea7 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -536,11 +536,6 @@ func (w *Worker) handleDeleteMessages(msg *types.DeleteMessages) error {
w.worker.Logger.Printf("error removing some messages: %v", err)
return err
}
-
- w.worker.PostMessage(&types.DirectoryInfo{
- Info: w.getDirectoryInfo(w.selectedName),
- }, nil)
-
return nil
}
@@ -617,15 +612,11 @@ func (w *Worker) handleCopyMessages(msg *types.CopyMessages) error {
if err != nil {
return err
}
-
- w.worker.PostMessage(&types.DirectoryInfo{
- Info: w.getDirectoryInfo(w.selectedName),
- }, nil)
-
- w.worker.PostMessage(&types.DirectoryInfo{
- Info: w.getDirectoryInfo(msg.Destination),
+ w.worker.PostMessage(&types.MessagesCopied{
+ Message: types.RespondTo(msg),
+ Destination: msg.Destination,
+ Uids: msg.Uids,
}, nil)
-
return nil
}