diff options
author | Johannes Kulick <kulick@hildensia.de> | 2012-12-12 12:37:28 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2013-02-19 10:10:07 +0000 |
commit | fd049b65bea0567aa645461d751c2971c6ef5440 (patch) | |
tree | b4eb5b7312cef29bc8aaec7c4961298a08d69620 | |
parent | 7a0a4158c78ee2f927e5c54868fb6e8a1d94f814 (diff) |
add unencrypt and toggleencrypt commands
-rw-r--r-- | alot/commands/envelope.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 93deec0c..086247d3 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -449,16 +449,26 @@ class SignCommand(Command): # reload buffer ui.current_buffer.rebuild() -@registerCommand(MODE, 'encrypt', arguments=[ +@registerCommand(MODE, 'encrypt', forced={'action':'encrypt'}, arguments=[ + (['keyid'], {'help':'keyid of the key to encrypt with'})]) +@registerCommand(MODE, 'unencrypt', forced={'action':'unencrypt'}) +@registerCommand(MODE, 'toggleencrypt', forced={'action':'toggleencrypt'}, arguments=[ (['keyid'], {'help':'keyid of the key to encrypt with'})]) class EncryptCommand(Command): - def __init__(self, keyid, **kwargs): + def __init__(self, action=None, keyid=None, **kwargs): self.encrypt_key = keyid + self.action = action Command.__init__(self, **kwargs) def apply(self, ui): envelope = ui.current_buffer.envelope - envelope.encrypt = True + if self.action == 'encrypt': + encrypt = True + elif self.action == 'unencrypt': + encrypt = False + elif self.action == 'toggleencrypt': + encrypt = not envelope.encrypt + envelope.encrypt = encrypt envelope.encrypt_key = self.encrypt_key #reload buffer ui.current_buffer.rebuild() |