diff options
author | Koni Marti <koni.marti@gmail.com> | 2024-02-02 11:04:40 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-02-14 23:20:46 +0100 |
commit | 6afc2d54eb27d6762815315a2de996714a5b8b6b (patch) | |
tree | 28960ca5e458e005631e20d96f0411ec2b2be9e8 /commands/msg | |
parent | 2927516175b7d92f2b4a271cce05d0ded0302f8a (diff) | |
download | aerc-6afc2d54eb27d6762815315a2de996714a5b8b6b.tar.gz |
commands: allow to reply to eml
Reply to messages in the message viewer that were opened with :eml (e.g.
rfc822 attachments). Those messages have no associated message store and
currently :reply would complain about that.
However, we can still use the message data to create a reply, but we
would have to disable setting the replied flag and/or archiving messages
(obviously, these operations don't make sense for such messages in the
first place).
Implements: https://todo.sr.ht/~rjarry/aerc/227
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands/msg')
-rw-r--r-- | commands/msg/reply.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/commands/msg/reply.go b/commands/msg/reply.go index 7a51a051..8eb2ff0d 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -73,10 +73,6 @@ func (r reply) Execute(args []string) error { } conf := acct.AccountConfig() - store := widget.Store() - if store == nil { - return errors.New("Cannot perform action. Messages still loading") - } msg, err := widget.SelectedMessage() if err != nil { return err @@ -157,6 +153,15 @@ func (r reply) Execute(args []string) error { } mv, isMsgViewer := app.SelectedTabContent().(*app.MessageViewer) + + store := widget.Store() + noStore := store == nil + if noStore && isMsgViewer { + app.PushWarning("No message store found: answered flag cannot be set") + } else if noStore { + return errors.New("Cannot perform action. Messages still loading") + } + addTab := func() error { composer, err := app.NewComposer(acct, acct.AccountConfig(), acct.Worker(), editHeaders, @@ -177,13 +182,13 @@ func (r reply) Execute(args []string) error { composer.OnClose(func(c *app.Composer) { switch { - case c.Sent() && c.Archive() != "": + case c.Sent() && c.Archive() != "" && !noStore: store.Answered([]uint32{msg.Uid}, true, nil) err := archive([]*models.MessageInfo{msg}, c.Archive()) if err != nil { app.PushStatus("Archive failed", 10*time.Second) } - case c.Sent(): + case c.Sent() && !noStore: store.Answered([]uint32{msg.Uid}, true, nil) case mv != nil && r.Close: view := account.ViewMessage{Peek: true} |