diff options
author | inwit <inwit@sindominio.net> | 2024-06-29 17:14:21 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-08-20 11:54:34 +0200 |
commit | b94b4c00c9c96355c411881b5e5cc42c5f83d159 (patch) | |
tree | 6369a6010c04f5db6772774575770c2dc949d844 | |
parent | a64563466ddcb9fc321b8dd540f929c979310af9 (diff) | |
download | aerc-b94b4c00c9c96355c411881b5e5cc42c5f83d159.tar.gz |
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 <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r-- | commands/completion_helpers.go | 2 | ||||
-rw-r--r-- | commands/msg/forward.go | 11 | ||||
-rw-r--r-- | config/ui.go | 1 | ||||
-rw-r--r-- | doc/aerc-config.5.scd | 5 | ||||
-rw-r--r-- | doc/aerc.1.scd | 2 | ||||
-rw-r--r-- | lib/msgstore.go | 11 | ||||
-rw-r--r-- | models/models.go | 3 | ||||
-rw-r--r-- | worker/types/messages.go | 6 |
8 files changed, 39 insertions, 2 deletions
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 diff --git a/config/ui.go b/config/ui.go index ee8f7054..9839db9b 100644 --- a/config/ui.go +++ b/config/ui.go @@ -56,6 +56,7 @@ type UIConfig struct { IconInvalid string `ini:"icon-invalid" default:"[s!]"` IconAttachment string `ini:"icon-attachment" default:"a"` IconReplied string `ini:"icon-replied" default:"r"` + IconForwarded string `ini:"icon-forwarded" default:"f"` IconNew string `ini:"icon-new" default:"N"` IconOld string `ini:"icon-old" default:"O"` IconDraft string `ini:"icon-draft" default:"d"` diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd index d54609ca..85c1dedc 100644 --- a/doc/aerc-config.5.scd +++ b/doc/aerc-config.5.scd @@ -428,6 +428,11 @@ These options are configured in the *[ui]* section of _aerc.conf_. Default: _r_ +*icon-forwarded* = _<string>_ + The icon to display in *column-flags* when the message has been forwarded. + + Default: _f_ + *icon-flagged* = _<string>_ The icon to display in *column-flags* when the message is flagged. diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd index 26713206..d91ce78f 100644 --- a/doc/aerc.1.scd +++ b/doc/aerc.1.scd @@ -475,6 +475,8 @@ message list, the message in the message viewer, etc). Message has been read _Answered_ Message has been answered + _Forwarded_ + Message has been forwarded _Flagged_ Message is flagged for urgent/special attention _Draft_ diff --git a/lib/msgstore.go b/lib/msgstore.go index c64f933d..f4dac36a 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -711,6 +711,8 @@ func (store *MessageStore) Flag(uids []uint32, flags models.Flags, flagName = "seen" case models.AnsweredFlag: flagName = "answered" + case models.ForwardedFlag: + flagName = "forwarded" case models.FlaggedFlag: flagName = "flagged" case models.DraftFlag: @@ -734,6 +736,15 @@ func (store *MessageStore) Answered(uids []uint32, answered bool, }, cb) } +func (store *MessageStore) Forwarded(uids []uint32, forwarded bool, + cb func(msg types.WorkerMessage), +) { + store.worker.PostAction(&types.ForwardedMessages{ + Forwarded: forwarded, + Uids: uids, + }, cb) +} + func (store *MessageStore) Uids() []uint32 { if store.ThreadedView() && store.builder != nil { if uids := store.builder.Uids(); len(uids) > 0 { diff --git a/models/models.go b/models/models.go index e05c81ac..749d14d9 100644 --- a/models/models.go +++ b/models/models.go @@ -25,6 +25,9 @@ const ( // AnsweredFlag marks a message as having been replied to AnsweredFlag + // ForwardedFlag marks a message as having been forwarded + ForwardedFlag + // DeletedFlag marks a message as having been deleted DeletedFlag diff --git a/worker/types/messages.go b/worker/types/messages.go index 3fd018b2..b91adbb7 100644 --- a/worker/types/messages.go +++ b/worker/types/messages.go @@ -186,6 +186,12 @@ type AnsweredMessages struct { Uids []uint32 } +type ForwardedMessages struct { + Message + Forwarded bool + Uids []uint32 +} + type CopyMessages struct { Message Destination string |