diff options
author | Jason Cox <me@jasoncarloscox.com> | 2024-01-25 08:25:51 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-01-26 21:36:15 +0100 |
commit | 11b035f120969758d1b08dddd761f9375504de55 (patch) | |
tree | bf028d7155ceb45deba3461cb73ed74413f3d965 /commands/msg | |
parent | 0aab8ac318f6dee479afba13d09a5d1d1c0baa91 (diff) | |
download | aerc-11b035f120969758d1b08dddd761f9375504de55.tar.gz |
flags: add support for draft flag
Support the draft flag wherever flags are used. Automatically set it
when postponing a message, and allow recalling a message without the -f
flag if it has the draft flag set, regardless of what folder it's in.
Notmuch doesn't seem to pick up on the draft flag when indexing even
though the flag is set on the maildir file. Explicitly set all tags
corresponding to set flags when appending a message in notmuch.
Changelog-added: Support the `draft` flag.
Signed-off-by: Jason Cox <me@jasoncarloscox.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands/msg')
-rw-r--r-- | commands/msg/read.go | 5 | ||||
-rw-r--r-- | commands/msg/recall.go | 12 |
2 files changed, 12 insertions, 5 deletions
diff --git a/commands/msg/read.go b/commands/msg/read.go index b487d8a8..5b4bd073 100644 --- a/commands/msg/read.go +++ b/commands/msg/read.go @@ -41,13 +41,16 @@ func (f *FlagMsg) ParseFlag(arg string) error { case "flagged": f.Flag = models.FlaggedFlag f.FlagName = "flagged" + case "draft": + f.Flag = models.DraftFlag + f.FlagName = "draft" default: return fmt.Errorf("Unknown flag %q", arg) } return nil } -var validFlags = []string{"seen", "answered", "flagged"} +var validFlags = []string{"seen", "answered", "flagged", "draft"} func (*FlagMsg) CompleteFlag(arg string) []string { return commands.FilterList(validFlags, arg, nil) diff --git a/commands/msg/recall.go b/commands/msg/recall.go index 059fe558..e5cd2ed1 100644 --- a/commands/msg/recall.go +++ b/commands/msg/recall.go @@ -15,6 +15,7 @@ import ( "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/log" + "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -44,10 +45,6 @@ func (r Recall) Execute(args []string) error { if acct == nil { return errors.New("No account selected") } - if acct.SelectedDirectory() != acct.AccountConfig().Postpone && !r.Force { - return errors.New("Use -f to recall from outside the " + - acct.AccountConfig().Postpone + " directory.") - } store := widget.Store() if store == nil { return errors.New("Cannot perform action. Messages still loading") @@ -57,6 +54,13 @@ func (r Recall) Execute(args []string) error { if err != nil { return errors.Wrap(err, "Recall failed") } + + if acct.SelectedDirectory() != acct.AccountConfig().Postpone && + !msgInfo.Flags.Has(models.DraftFlag) && !r.Force { + return errors.New("Use -f to recall non-draft messages from outside the " + + acct.AccountConfig().Postpone + " directory.") + } + log.Debugf("Recalling message <%s>", msgInfo.Envelope.MessageId) addTab := func(composer *app.Composer) { |