mu: decode rfc-2047-encoded mailing lists

Fixes #1292.

Note: does require rebuilding the mu database (--rebuild).
This commit is contained in:
djcb
2018-08-14 22:38:27 +03:00
parent abf02000ec
commit aafeb82a6e

View File

@ -228,6 +228,7 @@ get_fake_mailing_list_maybe (MuMsgFile *self)
static gchar* static gchar*
get_mailing_list (MuMsgFile *self) get_mailing_list (MuMsgFile *self)
{ {
char *dechdr, *res;
const char *hdr, *b, *e; const char *hdr, *b, *e;
hdr = g_mime_object_get_header (GMIME_OBJECT(self->_mime_msg), hdr = g_mime_object_get_header (GMIME_OBJECT(self->_mime_msg),
@ -235,15 +236,21 @@ get_mailing_list (MuMsgFile *self)
if (mu_str_is_empty (hdr)) if (mu_str_is_empty (hdr))
return get_fake_mailing_list_maybe (self); return get_fake_mailing_list_maybe (self);
dechdr = g_mime_utils_header_decode_phrase (hdr);
if (!dechdr)
return NULL;
e = NULL; e = NULL;
b = strchr (hdr, '<'); b = strchr (dechdr, '<');
if (b) if (b)
e = strchr (b, '>'); e = strchr (b, '>');
if (b && e) if (b && e)
return g_strndup (b + 1, e - b - 1); res = g_strndup (b + 1, e - b - 1);
else else
return g_strdup (hdr); res = g_strdup (dechdr);
return res;
} }