aboutsummaryrefslogtreecommitdiffstats
path: root/models/templates.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-05-15 14:36:42 +0200
committerRobin Jarry <robin@jarry.cc>2023-05-20 22:08:21 +0200
commit02099cc6ea29e8595f43abe5b6a475edc92e24e0 (patch)
tree1ba85ed9b8e4bb3cd4a75fa32834ace71b92e891 /models/templates.go
parent30c1a30168dfff8ca5eecb8d0fa42ab4b638f79d (diff)
downloadaerc-02099cc6ea29e8595f43abe5b6a475edc92e24e0.tar.gz
templates: add boolean flags
Allow accessing email flags via boolean properties instead of having to rely on obscure regular expressions on (.Flags | join ""). With this patch, it is now possible to do this: [ui] index-columns = star:1,name<15%,reply:1,subject,size>=,date>= column-star = {{if .IsFlagged}}★{{end}} column-name = {{if eq .Role "sent"}}{{.To | names | join ", "}}{{else}}{{.From | names | join ", "}}{{end}} column-reply = {{if .IsReplied}}{{end}} column-subject = {{.ThreadPrefix}}{{.Subject}} column-size = {{if .HasAttachment}}📎 {{end}}{{humanReadable .Size}} column-date = {{.DateAutoFormat .Date.Local}} Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'models/templates.go')
-rw-r--r--models/templates.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/models/templates.go b/models/templates.go
index f6d79c36..ae57c3fb 100644
--- a/models/templates.go
+++ b/models/templates.go
@@ -25,6 +25,12 @@ type TemplateData interface {
Number() int
Labels() []string
Flags() []string
+ IsReplied() bool
+ HasAttachment() bool
+ IsFlagged() bool
+ IsRecent() bool
+ IsUnread() bool
+ IsMarked() bool
MessageId() string
Role() string
Size() int