diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2012-05-11 23:09:51 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2012-05-11 23:24:49 +0200 |
commit | 30f484341070ac7905c8f82a1ee85fcc2d964afa (patch) | |
tree | 63cbeafbe9bafcc844793141231e8998d1576b1c /alot/db/envelope.py | |
parent | 9bcd918748f9d83e688833814c488bce05e41922 (diff) |
add sign_by_default account setting to enable GPG signatures by default, use existing gpg_key setting
Diffstat (limited to 'alot/db/envelope.py')
-rw-r--r-- | alot/db/envelope.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/alot/db/envelope.py b/alot/db/envelope.py index 9d8e2599..f75e9dd1 100644 --- a/alot/db/envelope.py +++ b/alot/db/envelope.py @@ -137,6 +137,25 @@ class Envelope(object): if self.sent_time: self.modified_since_sent = True + def apply_account_crypto_settings(self, account, ui): + """ + initializes sign and sign_key from the account settings. + """ + if account is None: + return + + self.sign = account.sign_by_default + + if account.gpg_key is None: + return + + try: + key = crypto.CryptoContext().get_key(str(account.gpg_key)) + except GPGProblem, e: + ui.notify(e.message, priority='error') + return + self.sign_key = key + def construct_mail(self): """ compiles the information contained in this envelope into a |