aboutsummaryrefslogtreecommitdiffstats
path: root/lib/format/format.go
diff options
context:
space:
mode:
authorBence Ferdinandy <bence@ferdinandy.com>2022-12-08 14:15:33 +0100
committerRobin Jarry <robin@jarry.cc>2022-12-14 11:24:43 +0100
commitadf74be4b5c55faa724d35ca7bea2603c3ef42f9 (patch)
tree87de802bbfef7a8455ad6e9d48f2a1f0b38a517a /lib/format/format.go
parentc05c2ffe0424b048b10e7dd1aca59ae9cf631f12 (diff)
downloadaerc-adf74be4b5c55faa724d35ca7bea2603c3ef42f9.tar.gz
msglist: add attachment indicator
Add indicator of an attachment to the flags and make the character used to be configurable. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Jens Grassel <jens@wegtam.com>
Diffstat (limited to 'lib/format/format.go')
-rw-r--r--lib/format/format.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/format/format.go b/lib/format/format.go
index e340c496..346702c6 100644
--- a/lib/format/format.go
+++ b/lib/format/format.go
@@ -80,7 +80,7 @@ type Ctx struct {
}
func ParseMessageFormat(format string, timeFmt string, thisDayTimeFmt string,
- thisWeekTimeFmt string, thisYearTimeFmt string, ctx Ctx) (
+ thisWeekTimeFmt string, thisYearTimeFmt string, iconAttachment string, ctx Ctx) (
string, []interface{}, error,
) {
if ctx.MsgInfo.Error != nil {
@@ -298,6 +298,7 @@ func ParseMessageFormat(format string, timeFmt string, thisDayTimeFmt string,
delFlag := ""
flaggedFlag := ""
markedFlag := ""
+ hasattachment := ""
seen := false
recent := false
answered := false
@@ -333,8 +334,13 @@ func ParseMessageFormat(format string, timeFmt string, thisDayTimeFmt string,
if ctx.MsgIsMarked {
markedFlag = "*"
}
+ for _, bS := range ctx.MsgInfo.BodyStructure.Parts {
+ if strings.ToLower(bS.Disposition) == "attachment" {
+ hasattachment = iconAttachment
+ }
+ }
retval = append(retval, '4', 's')
- args = append(args, readReplyFlag+delFlag+flaggedFlag+markedFlag)
+ args = append(args, readReplyFlag+delFlag+flaggedFlag+markedFlag+hasattachment)
// Move the below cases to proper alphabetical positions once
// implemented