~sircmpwn/aerc

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] reply -A added, makes sure From: is not in To:

JD
Details
Message ID
<C5CPVQGKIKEG.2B9IOT1K5DEUD@Penelope.local>
DKIM signature
pass
Download raw message
Patch: +26 -5
---
When applying reply -a to an email sent from ourselves,
our From: address will also be included in the To: field.
Some people use this (by mailing themselves a copy),
some people don't. This is a patch for those, who
don't: it introduces an additional -A parameter, which
replicates -a but also makes sure our From: address is
not included.

DISCLAIMER: I know nothing about Go, and I'm not even a 
developer / programmer.

 commands/msg/reply.go | 29 ++++++++++++++++++++++++-----
 doc/aerc.1.scd        |  3 +++
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 3c8016e..c2e1be5 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -4,6 +4,7 @@ import (
	"bytes"
	"errors"
	"fmt"
	"reflect"
	"io"
	"strings"

@@ -30,22 +31,26 @@ func (reply) Complete(aerc *widgets.Aerc, args []string) []string {
}

func (reply) Execute(aerc *widgets.Aerc, args []string) error {
	opts, optind, err := getopt.Getopts(args, "aqT:")
	opts, optind, err := getopt.Getopts(args, "aAqT:")
	if err != nil {
		return err
	}
	if optind != len(args) {
		return errors.New("Usage: reply [-aq -T <template>]")
		return errors.New("Usage: reply [-aAq -T <template>]")
	}
	var (
		quote    bool
		replyAll bool
		template string
		quote         bool
		replyAll      bool
		replyAllClean bool
		template      string
	)
	for _, opt := range opts {
		switch opt.Option {
		case 'a':
			replyAll = true
		case 'A':
			replyAll = true
			replyAllClean = true
		case 'q':
			quote = true
		case 'T':
@@ -98,6 +103,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {

	var (
		to []*models.Address
		tm []*models.Address
		cc []*models.Address
	)

@@ -137,6 +143,19 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
		recSet.AddList(cc)
	}

	if replyAllClean {
		// now, if requested, clean to header
		for _, addr := range to {
			// remove from header from to header
			// (with replyAllClean, we do not email ourlseves)
			if reflect.DeepEqual(from, addr) {
				continue
			}
			tm = append(tm, addr)
		}
		to = tm
	}

	var subject string
	if !strings.HasPrefix(strings.ToLower(msg.Envelope.Subject), "re: ") {
		subject = "Re: " + msg.Envelope.Subject
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index c2f813a..efb0750 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -139,6 +139,8 @@ message list, the message in the message viewer, etc).

	*-a*: Reply all

	*-A*: Reply all and make sure no From: address is present in To:

	*-q*: Insert a quoted version of the selected message into the reply editor

	*-T*: Use the specified template file for creating the initial message body
-- 
2.7.4




-- 
JD
Review patch Export thread (mbox)