diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-02-10 15:43:39 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-02-10 15:43:39 +0100 |
commit | 5081b4459bab07ab0552fdda5ffed4a8d32b4142 (patch) | |
tree | 3db853363f4b9e77d780250f76b6bd49ce03dae4 | |
parent | d905ff51e4ec2d69566f254e6d4064e05ec3a71a (diff) |
commands/thread: stop calling get_email in BounceCommand
Serialize the message and deserialize it again to avoid modifying it.
-rw-r--r-- | alot/commands/thread.py | 15 |
1 files 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() |