aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/recall.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-07-05 23:10:39 +0200
committerRobin Jarry <robin@jarry.cc>2023-07-17 10:24:17 +0200
commit4c514ce4d15fd14cad528cf426bc3f853efe7f64 (patch)
treefa52247b470a6af233a6e242962ed20e4831a555 /commands/msg/recall.go
parent11e5390fa0acbcc609ca177777548dd2d725afbc (diff)
downloadaerc-4c514ce4d15fd14cad528cf426bc3f853efe7f64.tar.gz
compose: allow changing edit-headers on the fly
Add -e|-E flags to all compose commands to allow switching between edit-headers = true/false without restarting aerc. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'commands/msg/recall.go')
-rw-r--r--commands/msg/recall.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/commands/msg/recall.go b/commands/msg/recall.go
index 71f8b8a5..c095caf1 100644
--- a/commands/msg/recall.go
+++ b/commands/msg/recall.go
@@ -10,6 +10,7 @@ import (
_ "github.com/emersion/go-message/charset"
"github.com/pkg/errors"
+ "git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/widgets"
@@ -33,19 +34,24 @@ func (Recall) Complete(aerc *widgets.Aerc, args []string) []string {
func (Recall) Execute(aerc *widgets.Aerc, args []string) error {
force := false
+ editHeaders := config.Compose.EditHeaders
- opts, optind, err := getopt.Getopts(args, "f")
+ opts, optind, err := getopt.Getopts(args, "feE")
if err != nil {
return err
}
for _, opt := range opts {
- if opt.Option == 'f' {
+ switch opt.Option {
+ case 'f':
force = true
+ case 'e':
+ editHeaders = true
+ case 'E':
+ editHeaders = false
}
}
-
if len(args) != optind {
- return errors.New("Usage: recall [-f]")
+ return errors.New("Usage: recall [-f] [-e|-E]")
}
widget := aerc.SelectedTabContent().(widgets.ProvidesMessage)
@@ -130,7 +136,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error {
msg.FetchBodyPart(path, func(reader io.Reader) {
composer, err := widgets.NewComposer(aerc, acct,
- acct.AccountConfig(), acct.Worker(),
+ acct.AccountConfig(), acct.Worker(), editHeaders,
"", msgInfo.RFC822Headers, nil, reader)
if err != nil {
aerc.PushError(err.Error())