Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display per message subjects in thread widget #1559

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions alot/db/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ def __init__(self, dbman, msg, thread=None):
self._from = '"{}" <{}>'.format(acc.realname, str(acc.address))
else:
self._from = '"Unknown" <>'
try:
self._subject = decode_header(msg.header('Subject'))
except (NullPointerError, LookupError):
self._subject = ''

def __str__(self):
"""prettyprint the message"""
Expand Down Expand Up @@ -132,6 +136,9 @@ def get_message_parts(self):
if not msg.is_multipart():
yield msg

def get_subject(self):
return self._subject

def get_tags(self):
"""returns tags attached to this message as list of strings"""
return sorted(self._tags)
Expand Down
3 changes: 3 additions & 0 deletions alot/widgets/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ def _render_wrap(size, focus=False):
def __str__(self):
author, address = self.message.get_author()
date = self.message.get_datestring()
subject = self.message.get_subject()
rep = author if author != '' else address
if date is not None:
rep += " (%s)" % date
if subject:
rep += ": %s" % subject
return rep

def selectable(self):
Expand Down