aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/account/search.go1
-rw-r--r--commands/completion_helpers.go2
-rw-r--r--commands/compose/postpone.go2
-rw-r--r--commands/msg/read.go5
-rw-r--r--commands/msg/recall.go12
5 files changed, 15 insertions, 7 deletions
diff --git a/commands/account/search.go b/commands/account/search.go
index be3b125f..0246a9eb 100644
--- a/commands/account/search.go
+++ b/commands/account/search.go
@@ -73,6 +73,7 @@ var flagValues = map[string]models.Flags{
"seen": models.SeenFlag,
"answered": models.AnsweredFlag,
"flagged": models.FlaggedFlag,
+ "draft": models.DraftFlag,
}
func (s *SearchFilter) ParseFlag(arg string) error {
diff --git a/commands/completion_helpers.go b/commands/completion_helpers.go
index e4556594..b7ba6780 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"}
+ return []string{"Seen", "Answered", "Flagged", "Draft"}
}
// GetDateList returns a list of date terms for completion
diff --git a/commands/compose/postpone.go b/commands/compose/postpone.go
index a869417b..3c23eda3 100644
--- a/commands/compose/postpone.go
+++ b/commands/compose/postpone.go
@@ -108,7 +108,7 @@ func (p Postpone) Execute(args []string) error {
}
store.Append(
targetFolder,
- models.SeenFlag,
+ models.SeenFlag|models.DraftFlag,
time.Now(),
buf,
buf.Len(),
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) {