diff options
author | Sebastien Binet <s@sbinet.org> | 2024-01-09 17:06:24 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-01-17 12:00:01 +0100 |
commit | ec8b22b8eec40a745978547f296c2ab3ad2a5569 (patch) | |
tree | 2d7df497d76bee5a01828ebf93e212639ef9dc7e /commands/msg/utils.go | |
parent | 680244d0533d2687039d947e00ff9c19abcf3ba8 (diff) | |
download | aerc-ec8b22b8eec40a745978547f296c2ab3ad2a5569.tar.gz |
reply,forward: use selected message part
Use the currently selected message part (if any) as the original message
for quote-reply and forward. Honor viewer::alternatives if no message
part was selected.
Signed-off-by: Sebastien Binet <s@sbinet.org>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands/msg/utils.go')
-rw-r--r-- | commands/msg/utils.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/commands/msg/utils.go b/commands/msg/utils.go index 42693348..d6dffd50 100644 --- a/commands/msg/utils.go +++ b/commands/msg/utils.go @@ -6,6 +6,7 @@ import ( "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/commands" + "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/models" ) @@ -59,3 +60,17 @@ func (h *helper) messages() ([]*models.MessageInfo, error) { } return commands.MsgInfoFromUids(store, uid, h.statusInfo) } + +func getMessagePart(msg *models.MessageInfo, provider app.ProvidesMessage) []int { + p := provider.SelectedMessagePart() + if p != nil { + return p.Index + } + for _, mime := range config.Viewer.Alternatives { + part := lib.FindMIMEPart(mime, msg.BodyStructure, nil) + if part != nil { + return part + } + } + return nil +} |