aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose
diff options
context:
space:
mode:
authorJason Cox <me@jasoncarloscox.com>2023-11-13 17:20:33 -0500
committerRobin Jarry <robin@jarry.cc>2023-11-23 00:14:44 +0100
commit48b9589d8bbe4ec8982c08a9fe6e59b77734eb80 (patch)
treee2d1b095bae16742168ba342133250a5b86525f2 /commands/compose
parent4120de14a8b184c18f7922553d5841d433379f41 (diff)
downloadaerc-48b9589d8bbe4ec8982c08a9fe6e59b77734eb80.tar.gz
compose: copy to composing account's sent folder
The composing account may be different than the currently selected account if the user has moved between different tabs since beginning the message. Fixes: faa879f9a84d ("hooks: add mail-added hook") Reported-by: Vitaly Ovchinnikov <v@ovch.ru> Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Vitaly Ovchinnikov <v@ovch.ru>
Diffstat (limited to 'commands/compose')
-rw-r--r--commands/compose/send.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go
index 315b6915..c642c356 100644
--- a/commands/compose/send.go
+++ b/commands/compose/send.go
@@ -228,7 +228,8 @@ func send(composer *app.Composer, ctx sendCtx,
}
if ctx.copyto != "" && ctx.scheme != "jmap" {
app.PushStatus("Copying to "+ctx.copyto, 10*time.Second)
- errch := copyToSent(ctx.copyto, copyBuf.Len(), &copyBuf)
+ errch := copyToSent(ctx.copyto, copyBuf.Len(), &copyBuf,
+ composer)
err = <-errch
if err != nil {
errmsg := fmt.Sprintf(
@@ -557,9 +558,9 @@ func newJmapSender(
return writer, err
}
-func copyToSent(dest string, n int, msg io.Reader) <-chan error {
+func copyToSent(dest string, n int, msg io.Reader, composer *app.Composer) <-chan error {
errCh := make(chan error, 1)
- acct := app.SelectedAccount()
+ acct := composer.Account()
if acct == nil {
errCh <- errors.New("No account selected")
return errCh