compose: add option to never include your own address when replying

Introduce an option in aerc.conf to disable the auto-including
of your own address when replying to your own emails (address
replies to the original To: and Cc: instead); default to true
(allow the auto-including)
This commit is contained in:
john1doe@ya.ru 2022-01-31 16:28:58 +02:00 committed by Robin Jarry
parent 622802d3a5
commit 27122ef8e8
4 changed files with 28 additions and 0 deletions

View File

@ -112,6 +112,19 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
} else { } else {
to = msg.Envelope.From to = msg.Envelope.From
} }
if !aerc.Config().Compose.ReplyToSelf {
for i, v := range to {
if v.Address == from.Address {
to = append(to[:i], to[i+1:]...)
break
}
}
if len(to) == 0 {
to = append(msg.Envelope.To)
}
}
recSet.AddList(to) recSet.AddList(to)
if replyAll { if replyAll {

View File

@ -194,6 +194,12 @@ header-layout=To|From,Subject
# ignored. # ignored.
address-book-cmd= address-book-cmd=
#
# Allow to address yourself when replying
#
# Default: true
reply-to-self=true
[filters] [filters]
# #
# Filters allow you to pipe an email body through a shell command to render # Filters allow you to pipe an email body through a shell command to render

View File

@ -123,6 +123,7 @@ type ComposeConfig struct {
Editor string `ini:"editor"` Editor string `ini:"editor"`
HeaderLayout [][]string `ini:"-"` HeaderLayout [][]string `ini:"-"`
AddressBookCmd string `ini:"address-book-cmd"` AddressBookCmd string `ini:"address-book-cmd"`
ReplyToSelf bool `ini:"reply-to-self"`
} }
type FilterConfig struct { type FilterConfig struct {
@ -595,6 +596,7 @@ func LoadConfigFromFile(root *string, sharedir string, logger *log.Logger) (*Aer
{"To", "From"}, {"To", "From"},
{"Subject"}, {"Subject"},
}, },
ReplyToSelf: true,
}, },
Templates: TemplateConfig{ Templates: TemplateConfig{

View File

@ -340,6 +340,13 @@ These options are configured in the *[compose]* section of aerc.conf.
Default: none Default: none
*reply-to-self*
Allow to include your own address. Otherwise, if set to false, do not mail
yourself when replying (e.g., if replying to emails previously sent by
yourself, address your replies to the original To: and Cc:).
Default: true
## FILTERS ## FILTERS
Filters allow you to pipe an email body through a shell command to render Filters allow you to pipe an email body through a shell command to render