From b94b4c00c9c96355c411881b5e5cc42c5f83d159 Mon Sep 17 00:00:00 2001 From: inwit Date: Sat, 29 Jun 2024 17:14:21 +0200 Subject: forward: allow forwarded flag to be set Usually, a MUA sets a flag for messages that have been forwarded, but this is currently not the case for aerc. Consider the forwarded flag and prepare aerc to set it everytime the :forward command is called and ends successfully. Changelog-added: The :forward command now sets the forwarded flag. Signed-off-by: inwit Acked-by: Robin Jarry --- commands/completion_helpers.go | 2 +- commands/msg/forward.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'commands') diff --git a/commands/completion_helpers.go b/commands/completion_helpers.go index 7f046630..92c33bea 100644 --- a/commands/completion_helpers.go +++ b/commands/completion_helpers.go @@ -45,7 +45,7 @@ func GetAddress(search string) []string { // GetFlagList returns a list of available flags for completion func GetFlagList() []string { - return []string{"Seen", "Answered", "Flagged", "Draft"} + return []string{"Seen", "Answered", "Forwarded", "Flagged", "Draft"} } // GetDateList returns a list of date terms for completion diff --git a/commands/msg/forward.go b/commands/msg/forward.go index 2f108e8e..cb2cab35 100644 --- a/commands/msg/forward.go +++ b/commands/msg/forward.go @@ -162,7 +162,10 @@ func (f forward) Execute(args []string) error { return } composer.AddAttachment(tmpFileName) - composer.OnClose(func(_ *app.Composer) { + composer.OnClose(func(c *app.Composer) { + if c.Sent() { + store.Forwarded([]uint32{msg.Uid}, true, nil) + } os.RemoveAll(tmpDir) }) }) @@ -211,6 +214,12 @@ func (f forward) Execute(args []string) error { return } + composer.OnClose(func(c *app.Composer) { + if c.Sent() { + store.Forwarded([]uint32{msg.Uid}, true, nil) + } + }) + // add attachments if f.AttachAll { var mu sync.Mutex -- cgit