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>
This commit is contained in:
parent
e8c5bb641a
commit
57933f65ab
1 changed files with 18 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue