* mu-msg-file: set the MU_FLAG_LIST flag, if the message looks like an ML-message

This commit is contained in:
djcb
2013-07-03 21:55:17 +03:00
parent 81c3e11c48
commit 3eb748737c

View File

@ -36,7 +36,6 @@ static gboolean init_file_metadata (MuMsgFile *self, const char* path,
const char *mdir, GError **err); const char *mdir, GError **err);
static gboolean init_mime_msg (MuMsgFile *msg, const char *path, GError **err); static gboolean init_mime_msg (MuMsgFile *msg, const char *path, GError **err);
MuMsgFile* MuMsgFile*
mu_msg_file_new (const char* filepath, const char *mdir, GError **err) mu_msg_file_new (const char* filepath, const char *mdir, GError **err)
{ {
@ -205,7 +204,7 @@ get_recipient (MuMsgFile *self, GMimeRecipientType rtype)
* headers in the mail * headers in the mail
*/ */
static gchar* static gchar*
get_fake_mailing_list (MuMsgFile *self) get_fake_mailing_list_maybe (MuMsgFile *self)
{ {
const char* hdr; const char* hdr;
@ -235,7 +234,7 @@ get_mailing_list (MuMsgFile *self)
hdr = g_mime_object_get_header (GMIME_OBJECT(self->_mime_msg), hdr = g_mime_object_get_header (GMIME_OBJECT(self->_mime_msg),
"List-Id"); "List-Id");
if (mu_str_is_empty (hdr)) if (mu_str_is_empty (hdr))
return get_fake_mailing_list (self); return get_fake_mailing_list_maybe (self);
e = NULL; e = NULL;
b = strchr (hdr, '<'); b = strchr (hdr, '<');
@ -311,7 +310,8 @@ msg_cflags_cb (GMimeObject *parent, GMimeObject *part, MuFlags *flags)
static MuFlags static MuFlags
get_content_flags (MuMsgFile *self) get_content_flags (MuMsgFile *self)
{ {
MuFlags flags; MuFlags flags;
char *ml;
flags = MU_FLAG_NONE; flags = MU_FLAG_NONE;
@ -320,6 +320,14 @@ get_content_flags (MuMsgFile *self)
FALSE, /* never decrypt for this */ FALSE, /* never decrypt for this */
(GMimeObjectForeachFunc)msg_cflags_cb, (GMimeObjectForeachFunc)msg_cflags_cb,
&flags); &flags);
ml = get_mailing_list (self);
if (ml) {
flags |= MU_FLAG_LIST;
g_free (ml);
}
return flags; return flags;
} }