aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--worker/imap/movecopy.go17
-rw-r--r--worker/imap/worker.go2
2 files changed, 19 insertions, 0 deletions
diff --git a/worker/imap/movecopy.go b/worker/imap/movecopy.go
index 1d25c08c..d3df133a 100644
--- a/worker/imap/movecopy.go
+++ b/worker/imap/movecopy.go
@@ -46,3 +46,20 @@ func (imapw *IMAPWorker) handleAppendMessage(msg *types.AppendMessage) {
imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
}
}
+
+func (imapw *IMAPWorker) handleMoveMessages(msg *types.MoveMessages) {
+ uids := toSeqSet(msg.Uids)
+ if err := imapw.client.UidMove(uids, msg.Destination); err != nil {
+ imapw.worker.PostMessage(&types.Error{
+ Message: types.RespondTo(msg),
+ Error: err,
+ }, nil)
+ } else {
+ imapw.worker.PostMessage(&types.MessagesMoved{
+ Message: types.RespondTo(msg),
+ Destination: msg.Destination,
+ Uids: msg.Uids,
+ }, nil)
+ imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
+ }
+}
diff --git a/worker/imap/worker.go b/worker/imap/worker.go
index 6b6c9261..66e4cdf6 100644
--- a/worker/imap/worker.go
+++ b/worker/imap/worker.go
@@ -205,6 +205,8 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error {
w.handleAnsweredMessages(msg)
case *types.CopyMessages:
w.handleCopyMessages(msg)
+ case *types.MoveMessages:
+ w.handleMoveMessages(msg)
case *types.AppendMessage:
w.handleAppendMessage(msg)
case *types.SearchDirectory: