summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-10-16 16:30:16 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-10-16 16:30:16 +0100
commitb4943f3e0b88a95691ed5d83e79d3c12ce6084d4 (patch)
tree227459833276cfc5ebce61f47b2ac9bf1326af5f
parentac2f01a54790f4cded4cc21ebb64c8bdac1f0a2f (diff)
fix envelope:set
-rw-r--r--alot/commands/envelope.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index c5f5c96a..7813c130 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -203,23 +203,21 @@ class EnvelopeEditCommand(Command):
@registerCommand(MODE, 'set', help='set header value', arguments=[
- (['--replace'], {'action': 'store_true', 'help':'remove old value'}),
+ (['--append'], {'action': 'store_true', 'help':'keep previous value'}),
(['key'], {'help':'header to refine'}),
(['value'], {'nargs':'+', 'help':'value'})])
class EnvelopeSetCommand(Command):
- """sets header fields of mail open in envelope buffer"""
-
- def __init__(self, key, value, replace=True, **kwargs):
+ def __init__(self, key, value, append=False, **kwargs):
self.key = key
- value = ' '.join(value)
- self.value = encode_header(key, value)
- self.replace = replace
+ self.value = encode_header(key, ' '.join(value))
+ self.append = append
Command.__init__(self, **kwargs)
def apply(self, ui):
envelope = ui.current_buffer
mail = envelope.get_email()
- if self.replace:
+ if not self.append:
del(mail[self.key])
mail[self.key] = self.value
+ envelope.set_email(mail)
envelope.rebuild()