diff options
-rw-r--r-- | alot/commands/thread.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py index b00cbd68..7ac7dd93 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -153,6 +153,18 @@ class ReplyCommand(Command): self.force_spawn = spawn super().__init__(**kwargs) + def _reply_subject(self, message): + subject = message.headers.get('Subject') or '' + reply_subject_hook = settings.get_hook('reply_subject') + if reply_subject_hook: + subject = reply_subject_hook(subject) + else: + rsp = settings.get('reply_subject_prefix') + if not subject.lower().startswith(('re:', rsp.lower())): + subject = rsp + subject + + return subject + async def apply(self, ui): message = ui.current_buffer.get_selected_message() mail = message.get_email() @@ -177,16 +189,7 @@ class ReplyCommand(Command): envelope = Envelope(bodytext = mailcontent, replied = message) - # copy subject - subject = message.headers.get('Subject') or '' - reply_subject_hook = settings.get_hook('reply_subject') - if reply_subject_hook: - subject = reply_subject_hook(subject) - else: - rsp = settings.get('reply_subject_prefix') - if not subject.lower().startswith(('re:', rsp.lower())): - subject = rsp + subject - envelope.add('Subject', subject) + envelope.add('Subject', self._reply_subject(message)) # Auto-detect ML auto_replyto_mailinglist = settings.get('auto_replyto_mailinglist') |