summaryrefslogtreecommitdiff
path: root/alot/message.py
diff options
context:
space:
mode:
authorpazz <patricktotzke@gmail.com>2011-08-14 14:22:11 +0100
committerpazz <patricktotzke@gmail.com>2011-08-14 14:22:11 +0100
commit20acc8a7b5c700a9c287ae59ecf4f4f318497aa6 (patch)
tree3ef3c95227fc35d780d9b7e83d9996173596bb51 /alot/message.py
parentbd1d61c3341b4b8b5d66772c8c5fe5b5173b1a93 (diff)
fill line w/o handling non-text parts
This makes searches a bit slower as all messages in all displayed treads are opened.
Diffstat (limited to 'alot/message.py')
-rw-r--r--alot/message.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/alot/message.py b/alot/message.py
index 57b66765..d464fdfd 100644
--- a/alot/message.py
+++ b/alot/message.py
@@ -157,6 +157,20 @@ class Message:
searchfor = querystring + ' AND id:' + self._id
return self._dbman.count_messages(searchfor) > 0
+ def get_text_content(self):
+ res = ''
+ for part in self.get_email().walk():
+ ctype = part.get_content_type()
+ enc = part.get_content_charset()
+ if part.get_content_maintype() == 'text':
+ raw_payload = part.get_payload(decode=True)
+ if enc:
+ raw_payload = raw_payload.decode(enc, errors='replace')
+ else:
+ raw_payload = unicode(raw_payload, errors='replace')
+ res += raw_payload
+ return res
+
def extract_body(mail):
bodytxt = ''