diff options
author | Bence Ferdinandy <bence@ferdinandy.com> | 2023-12-30 16:50:42 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-12-31 11:56:48 +0100 |
commit | 930e50328c3a57faeec7fd23881e044257eda157 (patch) | |
tree | 8f90ac9ccfaf4e2d15ce7392269c93a05c6b842e /lib/state/templates.go | |
parent | 90c44dab95a315d05e32a8f5e700b4ad8efdd38f (diff) | |
download | aerc-930e50328c3a57faeec7fd23881e044257eda157.tar.gz |
templates: add full path of file(s) as Filename(s)
For the maildir and notmuch backends, add the full path of the message
as Filename to templates. In case of a notmuch message having multiple
files associated with it, it returns a random path. Also add Filenames
to templates, which is a list of all associated message paths. This is
relevant for the notmuch backend, where a single messages is shown, if
there are multiple copies of it.
Changelog-added: Add filepath to messages in templates as .Filename(s)
Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/state/templates.go')
-rw-r--r-- | lib/state/templates.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/state/templates.go b/lib/state/templates.go index ef84f071..22cdbfa6 100644 --- a/lib/state/templates.go +++ b/lib/state/templates.go @@ -354,6 +354,23 @@ func (d *templateData) Labels() []string { return d.info.Labels } +func (d *templateData) Filename() string { + if d.info == nil { + return "" + } + if (d.info.Filenames != nil) && len(d.info.Filenames) > 0 { + return d.info.Filenames[0] + } + return "" +} + +func (d *templateData) Filenames() []string { + if d.info == nil { + return nil + } + return d.info.Filenames +} + func (d *templateData) Flags() []string { var flags []string if d.info == nil { |