diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-06 21:02:48 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-06 21:02:48 +0000 |
commit | 7dbf4f0b27e7adf0ed517ccbdd98c39838ed2fed (patch) | |
tree | d5d91f3850a2f0920ef4286d4dba3ad72c5f3335 /alot | |
parent | 6de43181363be70c4ba9093604df6297e87c5c80 (diff) | |
parent | 9a26e91d4731b40d75842ad979bfd93934a32419 (diff) |
Merge branch 'master' into docs
Diffstat (limited to 'alot')
-rw-r--r-- | alot/buffers.py | 5 | ||||
-rw-r--r-- | alot/commands/envelope.py | 3 | ||||
-rw-r--r-- | alot/commands/thread.py | 20 |
3 files changed, 13 insertions, 15 deletions
diff --git a/alot/buffers.py b/alot/buffers.py index 6313110e..2c49ed7c 100644 --- a/alot/buffers.py +++ b/alot/buffers.py @@ -5,7 +5,7 @@ import widgets import settings import commands from walker import PipeWalker -from message import decode_header +from helper import shorten_author_string class Buffer(object): @@ -99,7 +99,8 @@ class EnvelopeBuffer(Buffer): Buffer.__init__(self, ui, self.body, 'envelope') def __str__(self): - return "to: %s" % decode_header(self.mail['To']) + to = self.envelope.get('To', fallback='unset') + return "to: %s" % shorten_author_string(to, 400) def get_email(self): """returns message represented as :class:`email.Message`""" diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 07e5b576..4ebe9d5d 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -11,7 +11,6 @@ from alot.commands import Command, registerCommand from alot import settings from alot import helper from alot.message import decode_header -from alot.message import encode_header from alot.commands import globals from alot.helper import string_decode @@ -203,7 +202,7 @@ class EditCommand(Command): class SetCommand(Command): def __init__(self, key, value, append=False, **kwargs): self.key = key - self.value = encode_header(key, ' '.join(value)) + self.value = ' '.join(value) self.append = append Command.__init__(self, **kwargs) diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 19a235bf..fb0d9268 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -13,7 +13,6 @@ from alot import settings from alot import widgets from alot import completion from alot import helper -from alot.message import encode_header from alot.message import decode_header from alot.message import extract_headers from alot.message import extract_body @@ -61,7 +60,7 @@ class ReplyCommand(Command): subject = decode_header(mail.get('Subject', '')) if not subject.startswith('Re:'): subject = 'Re: ' + subject - envelope['Subject'] = Header(subject.encode('utf-8'), 'UTF-8').encode() + envelope['Subject'] = subject # set From my_addresses = ui.accountman.get_addresses() @@ -77,7 +76,7 @@ class ReplyCommand(Command): if matched_address: account = ui.accountman.get_account_by_address(matched_address) fromstring = '%s <%s>' % (account.realname, account.address) - envelope['From'] = encode_header('From', fromstring) + envelope['From'] = fromstring # set To if self.groupreply: @@ -85,19 +84,18 @@ class ReplyCommand(Command): if cleared: logging.info(mail['From'] + ', ' + cleared) to = mail['From'] + ', ' + cleared - envelope['To'] = encode_header('To', to) - logging.info(envelope['To']) + envelope['To'] = to else: - envelope['To'] = encode_header('To', mail['From']) + envelope['To'] = mail['From'] # copy cc and bcc for group-replies if 'Cc' in mail: cc = self.clear_my_address(my_addresses, mail['Cc']) - envelope['Cc'] = encode_header('Cc', cc) + envelope['Cc'] = cc if 'Bcc' in mail: bcc = self.clear_my_address(my_addresses, mail['Bcc']) - envelope['Bcc'] = encode_header('Bcc', bcc) + envelope['Bcc'] = bcc else: - envelope['To'] = encode_header('To', mail['From']) + envelope['To'] = mail['From'] # set In-Reply-To header envelope['In-Reply-To'] = '<%s>' % self.message.get_message_id() @@ -172,7 +170,7 @@ class ForwardCommand(Command): # copy subject subject = decode_header(mail.get('Subject', '')) subject = 'Fwd: ' + subject - envelope['Subject'] = Header(subject.encode('utf-8'), 'UTF-8').encode() + envelope['Subject'] = subject # set From my_addresses = ui.accountman.get_addresses() @@ -188,7 +186,7 @@ class ForwardCommand(Command): if matched_address: account = ui.accountman.get_account_by_address(matched_address) fromstring = '%s <%s>' % (account.realname, account.address) - envelope['From'] = encode_header('From', fromstring) + envelope['From'] = fromstring ui.apply_command(ComposeCommand(envelope=envelope)) |