summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/commands/envelope.py14
-rw-r--r--alot/commands/utils.py2
2 files changed, 15 insertions, 1 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index 0aa95cf2..54601422 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -418,12 +418,19 @@ class SetCommand(Command):
self.reset = not append
Command.__init__(self, **kwargs)
+ @inlineCallbacks
def apply(self, ui):
envelope = ui.current_buffer.envelope
if self.reset:
if self.key in envelope:
del envelope[self.key]
envelope.add(self.key, self.value)
+ # FIXME: handle BCC as well
+ # Currently we don't handle bcc because it creates a side channel leak,
+ # as the key of the person BCC'd will be available to other recievers,
+ # defeating the purpose of BCCing them
+ if self.key.lower() in ['to', 'from', 'cc']:
+ yield utils.set_encrypt(ui, ui.current_buffer.envelope)
ui.current_buffer.rebuild()
@@ -439,8 +446,15 @@ class UnsetCommand(Command):
self.key = key
Command.__init__(self, **kwargs)
+ @inlineCallbacks
def apply(self, ui):
del ui.current_buffer.envelope[self.key]
+ # FIXME: handle BCC as well
+ # Currently we don't handle bcc because it creates a side channel leak,
+ # as the key of the person BCC'd will be available to other recievers,
+ # defeating the purpose of BCCing them
+ if self.key.lower() in ['to', 'from', 'cc']:
+ yield utils.set_encrypt(ui, ui.current_buffer.envelope)
ui.current_buffer.rebuild()
diff --git a/alot/commands/utils.py b/alot/commands/utils.py
index 7a1c0ac1..e1fc26df 100644
--- a/alot/commands/utils.py
+++ b/alot/commands/utils.py
@@ -46,7 +46,7 @@ def set_encrypt(ui, envelope, block_error=False, signed_only=False):
keys = yield _get_keys(ui, encrypt_keys, block_error=block_error,
signed_only=signed_only)
if keys:
- envelope.encrypt_keys.update(keys)
+ envelope.encrypt_keys = keys
envelope.encrypt = True
if 'From' in envelope.headers: