aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/msg/utils.go')
-rw-r--r--commands/msg/utils.go15
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
+}