summary refs log tree commit diff stats
path: root/commands/msg
diff options
context:
space:
mode:
authorJeffas <dev@jeffas.io>2019-09-11 20:28:14 +0100
committerDrew DeVault <sir@cmpwn.com>2019-09-12 16:18:34 -0400
commite2d5c456dc27f958d79fdf740c7b0852b2af4160 (patch)
tree0e8b75b1996e142cb5b980ffe507634c5ff2fa03 /commands/msg
parenta93b4de6f3c362d6e0db0b1f6d3f2e1c9a5cd64d (diff)
downloadaerc-e2d5c456dc27f958d79fdf740c7b0852b2af4160.tar.gz
Add signatures
This adds the ability for per-account signatures in the accounts.conf
config file. The signature is added to emails in the editor at the
bottom of the email. This includes when forwarding, replying to, and
composing emails.

There are two config options: signature-file and signature-cmd. The
former allows a signature to be read from a file and the latter allows
an arbitrary command to be executed to return the signature.

The config options have been documented in aerc-config
Diffstat (limited to 'commands/msg')
-rw-r--r--commands/msg/forward.go4
-rw-r--r--commands/msg/reply.go6
-rw-r--r--commands/msg/unsubscribe.go1
3 files changed, 6 insertions, 5 deletions
diff --git a/commands/msg/forward.go b/commands/msg/forward.go
index b925a49..494072d 100644
--- a/commands/msg/forward.go
+++ b/commands/msg/forward.go
@@ -69,7 +69,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
 		"To":      to,
 		"Subject": subject,
 	}
-	composer := widgets.NewComposer(aerc.Config(), acct.AccountConfig(),
+	composer := widgets.NewComposer(aerc, aerc.Config(), acct.AccountConfig(),
 		acct.Worker(), defaults)
 
 	addTab := func() {
@@ -154,7 +154,7 @@ func forwardBodyPart(store *lib.MessageStore, composer *widgets.Composer,
 
 		pipeout, pipein := io.Pipe()
 		scanner := bufio.NewScanner(part.Body)
-		go composer.SetContents(pipeout)
+		go composer.PrependContents(pipeout)
 		// TODO: Let user customize the date format used here
 		io.WriteString(pipein, fmt.Sprintf("Forwarded message from %s on %s:\n\n",
 			msg.Envelope.From[0].Name,
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 7c40e97..9ef7a3b 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -116,8 +116,8 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
 		"In-Reply-To": msg.Envelope.MessageId,
 	}
 
-	composer := widgets.NewComposer(
-		aerc.Config(), acct.AccountConfig(), acct.Worker(), defaults)
+	composer := widgets.NewComposer(aerc, aerc.Config(),
+		acct.AccountConfig(), acct.Worker(), defaults)
 
 	if args[0] == "reply" {
 		composer.FocusTerminal()
@@ -170,7 +170,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
 
 			pipeout, pipein := io.Pipe()
 			scanner := bufio.NewScanner(part.Body)
-			go composer.SetContents(pipeout)
+			go composer.PrependContents(pipeout)
 			// TODO: Let user customize the date format used here
 			io.WriteString(pipein, fmt.Sprintf("On %s %s wrote:\n",
 				msg.Envelope.Date.Format("Mon Jan 2, 2006 at 3:04 PM"),
diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go
index f18da07..15a9411 100644
--- a/commands/msg/unsubscribe.go
+++ b/commands/msg/unsubscribe.go
@@ -88,6 +88,7 @@ func unsubscribeMailto(aerc *widgets.Aerc, u *url.URL) error {
 		"Subject": u.Query().Get("subject"),
 	}
 	composer := widgets.NewComposer(
+		aerc,
 		aerc.Config(),
 		acct.AccountConfig(),
 		acct.Worker(),