summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-10-22 11:52:45 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-10-22 11:52:45 +0100
commitf6b020cc441591739b157776e15a64827b91e300 (patch)
tree2a7cb5a7d5eb2d9413928ccc45451dcfb896b4a2
parentc9b8cfad0c1e3f032e6721a72134abd40bcad72f (diff)
use extract_body in pipeto command
-rw-r--r--alot/commands/thread.py19
1 files changed, 2 insertions, 17 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index b4729971..d8b6575f 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -20,6 +20,7 @@ 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
MODE = 'thread'
@@ -291,23 +292,7 @@ class PipeCommand(Command):
if self.decode:
for mail in mails:
headertext = extract_headers(mail)
-
- html = list(typed_subpart_iterator(mail, 'text', 'html'))
- plain = list(typed_subpart_iterator(mail, 'text', 'plain'))
-
- # body
- partsstrings = []
- # only take html parts if no plaintext alternative exists
- parts = plain
- if html and not plain:
- parts = html
-
- for part in parts:
- enc = part.get_content_charset() or 'ascii'
- partstring = ''.join(body_line_iterator(part, True))
- decoded = unicode(partstring, enc, errors='replace')
- partsstrings.append(decoded)
- bodytext = '\n\n'.join(partsstrings)
+ bodytext = extract_body(mail)
msg = '%s\n\n %s' % (headertext, bodytext)
mailstrings.append(msg.encode('utf-8'))
else: