diff options
author | Jason Cox <me@jasoncarloscox.com> | 2023-11-13 17:20:33 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-11-23 00:14:44 +0100 |
commit | 48b9589d8bbe4ec8982c08a9fe6e59b77734eb80 (patch) | |
tree | e2d1b095bae16742168ba342133250a5b86525f2 | |
parent | 4120de14a8b184c18f7922553d5841d433379f41 (diff) | |
download | aerc-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>
-rw-r--r-- | commands/compose/send.go | 7 |
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(), ©Buf) + errch := copyToSent(ctx.copyto, copyBuf.Len(), ©Buf, + 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 |