Skip to content

Commit

Permalink
allow mails without inlined multipart alternatives
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Van der Jeugt committed Dec 16, 2018
1 parent 08d4ebe commit 30001f7
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions alot/widgets/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def __init__(self, message, odd=True):
self._default_headers_tree = None
self.display_attachments = True
self._attachments = None
self._current_part = 0
self._current_part = None
self._multiparts = None
self._maintree = SimpleTree(self._assemble_structure())
CollapsibleTree.__init__(self, self._maintree)
Expand Down Expand Up @@ -259,19 +259,22 @@ def prev_part(self):
self._other_part(-1)

def _other_part(self, offset):
self._current_part += offset
self._current_part %= len(self._get_multiparts())
mps = self._get_multiparts()
if mps:
self._current_part += offset
self._current_part %= len(mps)

def _get_current_part(self):
if self._current_part < len(self._get_multiparts()):
return self._multiparts[self._current_part][1]
else:
return None
mps = self._get_multiparts()
if mps:
return mps[self._current_part][1]

def _get_multipart_selector(self):
return MultipartWidget(
[ctype for ctype, _ in self._get_multiparts()],
self._current_part)
mps = self._get_multiparts()
if mps:
return MultipartWidget(
[ctype for ctype, _ in self._get_multiparts()],
self._current_part)

def _get_multiparts(self):
if self._multiparts is None:
Expand All @@ -285,6 +288,8 @@ def _get_multiparts(self):
for ctype, text
in self._message.get_body_parts()]

self._current_part = 0

return self._multiparts

def _get_headers(self):
Expand Down

0 comments on commit 30001f7

Please sign in to comment.