summaryrefslogtreecommitdiff
path: root/alot/widgets
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-03-04 17:44:04 +0100
committerAnton Khirnov <anton@khirnov.net>2020-03-04 17:44:04 +0100
commit238be3bafed5c9f4aa8015c85ffe429fb698443a (patch)
tree53cd20a66d1714338a3a8e415c08f2cc14dbcf87 /alot/widgets
parenta558da1fd4ee9e3768ade72ea097704ad5dcd812 (diff)
db/utils: drop decode_header()
It is almost entirely unnecessary - python's email messages decode the headers themselves. Do the "normalization" bit directly in the single place where it is done, though properly there should be more thorough message text sanitization somewhere (most likely in our message wrapper).
Diffstat (limited to 'alot/widgets')
-rw-r--r--alot/widgets/thread.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py
index 0096188d..db0af0e0 100644
--- a/alot/widgets/thread.py
+++ b/alot/widgets/thread.py
@@ -11,10 +11,9 @@ import urwid
from .globals import TagWidget
from .globals import AttachmentWidget
from ..settings.const import settings
-from ..db.utils import decode_header, X_SIGNATURE_MESSAGE_HEADER
+from ..db.utils import X_SIGNATURE_MESSAGE_HEADER
from ..helper import string_sanitize
-
class MessageSummaryWidget(urwid.WidgetWrap):
"""
one line summary of a :class:`~alot.db.message.Message`.
@@ -60,7 +59,7 @@ class MessageSummaryWidget(urwid.WidgetWrap):
mail = self.message.get_email()
subj = mail.get_all('subject', [''])
- subj = ','.join([decode_header(s, normalize = True) for s in subj])
+ subj = re.sub(r'\n\s+', r' ', ','.join(subj))
author, address = self.message.get_author()
date = self.message.get_datestring()
@@ -128,7 +127,7 @@ class HeadersWidget(urwid.WidgetWrap):
# TODO even/odd
keyw = ('fixed', max_key_len + 1,
urwid.Text((self._key_attr, key)))
- valuew = urwid.Text((self._value_attr, decode_header(value)))
+ valuew = urwid.Text((self._value_attr, value))
linew = urwid.AttrMap(urwid.Columns([keyw, valuew]), self._gaps_attr)
widgets.append(linew)