diff options
author | pazz <patricktotzke@gmail.com> | 2011-07-20 11:49:30 +0100 |
---|---|---|
committer | pazz <patricktotzke@gmail.com> | 2011-07-20 11:49:30 +0100 |
commit | a28ad390a2b53aa6b3290f257f98bc13adcb7b0c (patch) | |
tree | 45b4baacce81c29dfabb597dd3182e66f58e739f | |
parent | ef2edc0210377f02638eb30ed3f09c67410f6569 (diff) |
close envelope on success. issue #53
-rw-r--r-- | alot/commands.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/alot/commands.py b/alot/commands.py index 2b8d312a..09f196e7 100644 --- a/alot/commands.py +++ b/alot/commands.py @@ -347,21 +347,17 @@ class ToggleThreadTagCommand(Command): class SendMailCommand(Command): - def __init__(self, email=None, envelope=None, **kwargs): - self.email = email - self.envelope_buffer = envelope - Command.__init__(self, **kwargs) def apply(self, ui): - mail = ui.current_buffer.get_email() + envelope = ui.current_buffer + mail = envelope.get_email() sname, saddr = email.Utils.parseaddr(mail.get('From')) account = get_account_by_address(saddr) if account: success, reason = account.sender.send_mail(mail) if success: - if self.envelope_buffer: # close the envelope - cmd = BufferCloseCommand(buffer=self.envelope_buffer) - ui.apply_command(cmd) + cmd = BufferCloseCommand(buffer=envelope) + ui.apply_command(cmd) ui.notify('mail send successful') else: ui.notify('failed to send: %s' % reason) |