diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2022-08-16 16:23:38 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-08-22 15:46:52 +0200 |
commit | 57933f65ab456fc4ac81423422b6686801e08c9e (patch) | |
tree | 10224a575ed858166f8aa584e4b1be63a226b095 /worker/mbox/worker.go | |
parent | e8c5bb641a9f31979bebf0f827befcfb4456bb9d (diff) | |
download | aerc-57933f65ab456fc4ac81423422b6686801e08c9e.tar.gz |
mbox: implement MoveMessages handling
Implement MoveMessages handling in the mbox backend. The mbox backend
exists entirely in memory, so the handling is equivalent to a
copy-and-delete.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/mbox/worker.go')
-rw-r--r-- | worker/mbox/worker.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/worker/mbox/worker.go b/worker/mbox/worker.go index 71da8161..067147e0 100644 --- a/worker/mbox/worker.go +++ b/worker/mbox/worker.go @@ -295,6 +295,24 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { w.worker.PostMessage( &types.Done{Message: types.RespondTo(msg)}, nil) + case *types.MoveMessages: + err := w.data.Copy(msg.Destination, w.name, msg.Uids) + if err != nil { + reterr = err + break + } + deleted := w.folder.Delete(msg.Uids) + if len(deleted) > 0 { + w.worker.PostMessage(&types.MessagesDeleted{ + Message: types.RespondTo(msg), + Uids: deleted, + }, nil) + } + w.worker.PostMessage(&types.DirectoryInfo{ + Info: w.data.DirectoryInfo(msg.Destination), + }, nil) + w.worker.PostMessage( + &types.Done{Message: types.RespondTo(msg)}, nil) case *types.SearchDirectory: uids, err := filterUids(w.folder, w.folder.Uids(), msg.Argv) |