aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/invite.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/msg/invite.go')
-rw-r--r--commands/msg/invite.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/commands/msg/invite.go b/commands/msg/invite.go
index 6273d520..309fe643 100644
--- a/commands/msg/invite.go
+++ b/commands/msg/invite.go
@@ -12,6 +12,7 @@ import (
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/widgets"
+ "git.sr.ht/~sircmpwn/getopt"
"github.com/emersion/go-message/mail"
)
@@ -48,6 +49,23 @@ func (invite) Execute(aerc *widgets.Aerc, args []string) error {
return fmt.Errorf("no invitation found (missing text/calendar)")
}
+ editHeaders := config.Compose.EditHeaders
+ opts, optind, err := getopt.Getopts(args, "eE")
+ if err != nil {
+ return err
+ }
+ if len(args) != optind {
+ return errors.New("Usage: accept|accept-tentative|decline [-e|-E]")
+ }
+ for _, opt := range opts {
+ switch opt.Option {
+ case 'e':
+ editHeaders = true
+ case 'E':
+ editHeaders = false
+ }
+ }
+
subject := trimLocalizedRe(msg.Envelope.Subject, acct.AccountConfig().LocalizedRe)
switch args[0] {
case "accept":
@@ -138,7 +156,8 @@ func (invite) Execute(aerc *widgets.Aerc, args []string) error {
addTab := func(cr *calendar.Reply) error {
composer, err := widgets.NewComposer(aerc, acct,
- acct.AccountConfig(), acct.Worker(), "", h, &original, cr.PlainText)
+ acct.AccountConfig(), acct.Worker(), editHeaders,
+ "", h, &original, cr.PlainText)
if err != nil {
aerc.PushError("Error: " + err.Error())
return err