summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-02-10 16:10:32 +0100
committerAnton Khirnov <anton@khirnov.net>2021-02-10 16:10:32 +0100
commitb43672e30db207d7d22867a8f9def58f9e989288 (patch)
treed9f8ab1a70c8a1da1dfa0e1aada8652071d6ed5a
parent8670bddb27bb634c286ab47172bb9c82db3678ac (diff)
commands/thread:ReplyCommand: drop unnecessary instance variable
-rw-r--r--alot/commands/thread.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index ea468bc0..b57a6c02 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -137,11 +137,9 @@ class ReplyCommand(Command):
"""reply to message"""
repeatable = True
- def __init__(self, message=None, all=False, listreply=None, spawn=None,
+ def __init__(self, all=False, listreply=None, spawn=None,
**kwargs):
"""
- :param message: message to reply to (defaults to selected message)
- :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; autodetect if unset and enabled in
@@ -150,21 +148,18 @@ class ReplyCommand(Command):
:param spawn: force spawning of editor in a new terminal
:type spawn: bool
"""
- self.message = message
self.groupreply = all
self.listreply = listreply
self.force_spawn = spawn
super().__init__(**kwargs)
async def apply(self, ui):
- # get message to reply to if not given in constructor
- if not self.message:
- self.message = ui.current_buffer.get_selected_message()
- mail = self.message.get_email()
+ message = ui.current_buffer.get_selected_message()
+ mail = message.get_email()
# set body text
name, address = parseaddr(mail['From'])
- timestamp = self.message.date
+ timestamp = message.date
qf = settings.get_hook('reply_prefix')
if qf:
quotestring = qf(name, address, timestamp,
@@ -174,13 +169,13 @@ class ReplyCommand(Command):
mailcontent = quotestring
quotehook = settings.get_hook('text_quote')
if quotehook:
- mailcontent += quotehook(self.message.get_body_text())
+ mailcontent += quotehook(message.get_body_text())
else:
quote_prefix = settings.get('quote_prefix')
- for line in self.message.get_body_text().splitlines():
+ for line in message.get_body_text().splitlines():
mailcontent += quote_prefix + line + '\n'
- envelope = Envelope(bodytext=mailcontent, replied=self.message)
+ envelope = Envelope(bodytext = mailcontent, replied = message)
# copy subject
subject = mail.get('Subject', '')
@@ -286,7 +281,7 @@ class ReplyCommand(Command):
envelope.add('Mail-Followup-To', followupto)
# set In-Reply-To header
- envelope.add('In-Reply-To', '<%s>' % self.message.id)
+ envelope.add('In-Reply-To', '<%s>' % message.id)
# set References header
old_references = mail.get('References', '')
@@ -295,10 +290,10 @@ class ReplyCommand(Command):
references = old_references[-8:]
if len(old_references) > 8:
references = old_references[:1] + references
- references.append('<%s>' % self.message.id)
+ references.append('<%s>' % message.id)
envelope.add('References', ' '.join(references))
else:
- envelope.add('References', '<%s>' % self.message.id)
+ envelope.add('References', '<%s>' % message.id)
# continue to compose
encrypt = mail.get_content_subtype() == 'encrypted'