diff --git a/alot/db/message.py b/alot/db/message.py index 6b1a3d9b8..ab08ad124 100644 --- a/alot/db/message.py +++ b/alot/db/message.py @@ -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""" @@ -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) diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py index c5276df83..ffbfb5d46 100644 --- a/alot/widgets/thread.py +++ b/alot/widgets/thread.py @@ -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):