diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-05-15 19:41:21 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-05-15 19:41:21 -0400 |
commit | b0bf09b98fc038c1bc9921d568c06260b7448a15 (patch) | |
tree | acad72b3ec224d95c551a11ba35cf4e8522641e1 /worker/imap/movecopy.go | |
parent | 52b318127fe7ec001ca824947193b2cb7b0ebda6 (diff) | |
download | aerc-b0bf09b98fc038c1bc9921d568c06260b7448a15.tar.gz |
Copy sent emails to the Sent folder
Or rather, to a user-specified folder
Diffstat (limited to 'worker/imap/movecopy.go')
-rw-r--r-- | worker/imap/movecopy.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/worker/imap/movecopy.go b/worker/imap/movecopy.go index 8c42a2e..1234e60 100644 --- a/worker/imap/movecopy.go +++ b/worker/imap/movecopy.go @@ -1,6 +1,8 @@ package imap import ( + "io" + "git.sr.ht/~sircmpwn/aerc2/worker/types" ) @@ -14,3 +16,28 @@ func (imapw *IMAPWorker) handleCopyMessages(msg *types.CopyMessages) { imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) } } + +type appendLiteral struct { + io.Reader + Length int +} + +func (m appendLiteral) Len() int { + return m.Length +} + +func (imapw *IMAPWorker) handleAppendMessage(msg *types.AppendMessage) { + if err := imapw.client.Append(msg.Destination, msg.Flags, msg.Date, + &appendLiteral{ + Reader: msg.Reader, + Length: msg.Length, + }); err != nil { + + imapw.worker.PostMessage(&types.Error{ + Message: types.RespondTo(msg), + Error: err, + }, nil) + } else { + imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + } +} |