~sircmpwn/aerc

mailto: support body parameter v1 PROPOSED

Zach DeCook: 1
 mailto: support body parameter

 3 files changed, 7 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/patches/15213/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] mailto: support body parameter Export this patch

---
 Makefile           | 1 +
 templates/verbatim | 2 ++
 widgets/aerc.go    | 5 ++++-
 3 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 templates/verbatim

diff --git a/Makefile b/Makefile
index 77f5e61..e979e2d 100644
--- a/Makefile
+++ b/Makefile
@@ -84,6 +84,7 @@ install: all
	install -m755 filters/plaintext $(DESTDIR)$(SHAREDIR)/filters/plaintext
	install -m644 templates/quoted_reply $(DESTDIR)$(SHAREDIR)/templates/quoted_reply
	install -m644 templates/forward_as_body $(DESTDIR)$(SHAREDIR)/templates/forward_as_body
	install -m644 templates/verbatim $(DESTDIR)$(SHAREDIR)/templates/verbatim
	install -m644 config/default_styleset $(DESTDIR)$(SHAREDIR)/stylesets/default

RMDIR_IF_EMPTY:=sh -c '\
diff --git a/templates/verbatim b/templates/verbatim
new file mode 100644
index 0000000..e850738
--- /dev/null
+++ b/templates/verbatim
@@ -0,0 +1,2 @@

{{.OriginalText}}
diff --git a/widgets/aerc.go b/widgets/aerc.go
index b4b4e28..99212bc 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -499,6 +499,7 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
	}

	var subject string
	var body string
	h := &mail.Header{}
	h.SetAddressList("to", []*mail.Address{&mail.Address{Address: addr.Opaque}})
	for key, vals := range addr.Query() {
@@ -514,6 +515,8 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
		case "subject":
			subject = strings.Join(vals, ",")
			h.SetText("Subject", subject)
		case "body":
			body = strings.Join(vals, ",")
		default:
			// any other header gets ignored on purpose to avoid control headers
			// being injected
@@ -521,7 +524,7 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
	}

	composer, err := NewComposer(aerc, acct, aerc.Config(),
		acct.AccountConfig(), acct.Worker(), "", h, models.OriginalMail{})
		acct.AccountConfig(), acct.Worker(), "verbatim", h, models.OriginalMail{Text: body})
	if err != nil {
		return nil
	}
-- 
2.29.2