diff options
author | Guillaume Seren <guillaumeseren@gmail.com> | 2015-11-03 09:09:48 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2015-12-16 16:02:00 +0000 |
commit | 4e8da3eb86562941c555c77bacae302bc7f9e75f (patch) | |
tree | a36770442461643d25e447bb38d64f7cd0733d4d | |
parent | 8b065ebdd292c84d63a56a1b506e44259b9932ea (diff) |
Auto detect mailing list reply
Auto-detect the '--list' for you automagically when you just ':reply'
on a list, it is based on a config param that give you the control,
by default it is off, you have to setup your config file, like:
auto_replyto_mailinglist = True
-rw-r--r-- | alot/commands/thread.py | 10 | ||||
-rw-r--r-- | alot/defaults/alot.rc.spec | 3 | ||||
-rw-r--r-- | docs/source/configuration/alotrc_table | 10 |
3 files changed, 21 insertions, 2 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 21e2721b..3c9c9658 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -119,7 +119,7 @@ class ReplyCommand(Command): :type message: `alot.db.message.Message` :param all: group reply; copies recipients from Bcc/Cc/To to the reply :type all: bool - :param listreply: reply to list + :param listreply: reply to list; autodetect if unset and enabled in config :type listreply: bool :param spawn: force spawning of editor in a new terminal :type spawn: bool @@ -166,6 +166,11 @@ class ReplyCommand(Command): subject = rsp + subject envelope.add('Subject', subject) + # Auto-detect ML + auto_replyto_mailinglist = settings.get('auto_replyto_mailinglist') + if auto_replyto_mailinglist and mail['List-Id']: + self.listreply = True + # set From-header and sending account try: from_header, account = determine_sender(mail, 'reply') @@ -229,7 +234,8 @@ class ReplyCommand(Command): to = mail['To'] logging.debug('mail list reply to: %s' % to) # Cleaning the 'To' in this case - envelope.__delitem__('To') + if envelope.get('To') is not None: + envelope.__delitem__('To') # Finally setup the 'To' header envelope.add('To', decode_header(to)) diff --git a/alot/defaults/alot.rc.spec b/alot/defaults/alot.rc.spec index 4efc7b4a..cf4fb6de 100644 --- a/alot/defaults/alot.rc.spec +++ b/alot/defaults/alot.rc.spec @@ -209,6 +209,9 @@ followup_to = boolean(default=False) # The list of addresses associated to the mailinglists you are subscribed to mailinglists = force_list(default=list()) +# Automatically switch to list reply mode if appropriate +auto_replyto_mailinglist = boolean(default=False) + # prefer plaintext alternatives over html content in multipart/alternative prefer_plaintext = boolean(default=False) diff --git a/docs/source/configuration/alotrc_table b/docs/source/configuration/alotrc_table index 788c2410..35b11fa2 100644 --- a/docs/source/configuration/alotrc_table +++ b/docs/source/configuration/alotrc_table @@ -56,6 +56,16 @@ :default: True +.. _auto_replyto_mailinglist: + +.. describe:: auto_replyto_mailinglist + + Automatically switch to list reply mode if appropriate + + :type: boolean + :default: False + + .. _bufferclose-focus-offset: .. describe:: bufferclose_focus_offset |