summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-10-19 16:14:11 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-10-19 16:14:11 +0100
commitc1f26233c55c58292f61d5213bead829fb6d8d42 (patch)
tree4da80f999c222591a032f0122c8259fb129d4a1e
parent34ab794e6427e77fe9e9c21ccb7c76f31406af1a (diff)
make envelope.edit respect black/whitelists
-rw-r--r--alot/commands/envelope.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index 7b189257..16092403 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -140,7 +140,7 @@ class EnvelopeEditCommand(Command):
# go through multiline, utf-8 encoded headers
key = value = None
for line in headertext.splitlines():
- if re.match('\w+:', line): # new k/v pair
+ if re.match('[a-zA-Z0-9_-]+:', line): # new k/v pair
if key and value: # save old one from stack
del self.mail[key] # ensure unique values in mails
self.mail[key] = encode_header(key, value) # save
@@ -167,7 +167,15 @@ class EnvelopeEditCommand(Command):
ui.current_buffer.set_email(self.mail)
# decode header
- edit_headers = ['Subject', 'To', 'From']
+ edit_headers = set(settings.config.getstringlist('general',
+ 'edit_headers_whitelist'))
+ if '*' in edit_headers:
+ edit_headers = set(self.mail.keys())
+ blacklist = set(settings.config.getstringlist('general',
+ 'edit_headers_blacklist'))
+ ui.logger.debug('BLACKLIST: %s' % blacklist)
+ edit_headers = edit_headers - blacklist
+
headertext = u''
for key in edit_headers:
value = u''