From 5081b4459bab07ab0552fdda5ffed4a8d32b4142 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 10 Feb 2021 15:43:39 +0100 Subject: commands/thread: stop calling get_email in BounceCommand Serialize the message and deserialize it again to avoid modifying it. --- alot/commands/thread.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 646a45bd..1d694f94 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -401,19 +401,10 @@ class BounceMailCommand(Command): """directly re-send selected message""" repeatable = True - def __init__(self, message=None, **kwargs): - """ - :param message: message to bounce (defaults to selected message) - :type message: `alot.db.message.Message` - """ - self.message = message - super().__init__(**kwargs) - async def apply(self, ui): - # get mail to bounce - 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 = email.message_from_bytes(message.as_bytes(), + policy = email.policy.SMTP) # look if this makes sense: do we have any accounts set up? my_accounts = settings.get_accounts() -- cgit v1.2.3