aboutsummaryrefslogtreecommitdiff
path: root/libsylph/procheader.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-09-13 09:13:15 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-09-13 09:13:15 +0000
commit9b801d5b1903a5f7939bb9b0cb68d0058217f668 (patch)
tree922994cc41ec3e00b6f4d1b0133c2178e2a3f76a /libsylph/procheader.c
parentaf662f794d118ff080b616c5315b3a1f831fb4a3 (diff)
distinguish icon for HTML mail and other mail with attachments on summaryview (#84).
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3281 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/procheader.c')
-rw-r--r--libsylph/procheader.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/libsylph/procheader.c b/libsylph/procheader.c
index a06ac701..93ef99e7 100644
--- a/libsylph/procheader.c
+++ b/libsylph/procheader.c
@@ -688,9 +688,14 @@ MsgInfo *procheader_parse_stream(FILE *fp, MsgFlags flags, gboolean full)
case H_CONTENT_TYPE:
if (!g_ascii_strncasecmp(hp, "multipart", 9)) {
MSG_SET_TMP_FLAGS(msginfo->flags, MSG_MIME);
- } else if (!charset) {
- procmime_scan_content_type_str
- (hp, NULL, &charset, NULL, NULL);
+ } else {
+ if (!g_ascii_strncasecmp(hp, "text/html", 9)) {
+ MSG_SET_TMP_FLAGS(msginfo->flags, MSG_MIME_HTML);
+ }
+ if (!charset) {
+ procmime_scan_content_type_str
+ (hp, NULL, &charset, NULL, NULL);
+ }
}
break;
case H_SEEN:
@@ -740,6 +745,28 @@ MsgInfo *procheader_parse_stream(FILE *fp, MsgFlags flags, gboolean full)
msginfo->inreplyto =
g_strdup((gchar *)msginfo->references->data);
+ if (MSG_IS_MIME(msginfo->flags)) {
+ MimeInfo *mimeinfo, *part;
+ gboolean has_html = FALSE;
+
+ part = mimeinfo = procmime_scan_message_stream(fp);
+ while (part) {
+ if (part->mime_type != MIME_TEXT &&
+ part->mime_type != MIME_TEXT_HTML &&
+ part->mime_type != MIME_MULTIPART)
+ break;
+ if (part->mime_type == MIME_TEXT_HTML)
+ has_html = TRUE;
+ part = procmime_mimeinfo_next(part);
+ }
+
+ if (has_html && !part) {
+ MSG_SET_TMP_FLAGS(msginfo->flags, MSG_MIME_HTML);
+ }
+
+ procmime_mimeinfo_free_all(mimeinfo);
+ }
+
g_free(charset);
return msginfo;