diff options
author | Robin Jarry <robin@jarry.cc> | 2024-06-29 01:15:19 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-08-03 20:19:37 +0200 |
commit | 954c812d840030f3013ef06621dd537c8b14b23d (patch) | |
tree | e1a3a7a0119c246f8969a64691e69c9b7abc0bfe /worker | |
parent | cd92da0e893ab6741bb6d411434edbb03a570c7d (diff) | |
download | aerc-954c812d840030f3013ef06621dd537c8b14b23d.tar.gz |
reply: allow copying to current folder
Add a new copy-to-replied setting in accounts.conf to copy sent replies
to the same folder than their replied message.
Requested-by: Tristan Partin <tristan@partin.io>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Tristan Partin <tristan@partin.io>
Diffstat (limited to 'worker')
-rw-r--r-- | worker/jmap/send.go | 14 | ||||
-rw-r--r-- | worker/types/messages.go | 5 |
2 files changed, 12 insertions, 7 deletions
diff --git a/worker/jmap/send.go b/worker/jmap/send.go index 0791419c..757e5420 100644 --- a/worker/jmap/send.go +++ b/worker/jmap/send.go @@ -66,6 +66,14 @@ func (w *JMAPWorker) handleStartSend(msg *types.StartSendingMessage) error { }) } envelope := &emailsubmission.Envelope{MailFrom: from, RcptTo: rcpts} + onSuccess := jmap.Patch{ + "keywords/$draft": nil, + w.rolePatch(mailbox.RoleSent): true, + w.rolePatch(mailbox.RoleDrafts): nil, + } + if copyTo := w.dir2mbox[msg.CopyTo]; copyTo != "" { + onSuccess[w.mboxPatch(copyTo)] = true + } // Create the submission req.Invoke(&emailsubmission.Set{ Account: w.AccountId(), @@ -77,11 +85,7 @@ func (w *JMAPWorker) handleStartSend(msg *types.StartSendingMessage) error { }, }, OnSuccessUpdateEmail: map[jmap.ID]jmap.Patch{ - "#sub": { - "keywords/$draft": nil, - w.rolePatch(mailbox.RoleSent): true, - w.rolePatch(mailbox.RoleDrafts): nil, - }, + "#sub": onSuccess, }, }) diff --git a/worker/types/messages.go b/worker/types/messages.go index 9a2d43f8..3fd018b2 100644 --- a/worker/types/messages.go +++ b/worker/types/messages.go @@ -218,8 +218,9 @@ type CheckMail struct { type StartSendingMessage struct { Message - From *mail.Address - Rcpts []*mail.Address + From *mail.Address + Rcpts []*mail.Address + CopyTo string } // Messages |