aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog11
-rw-r--r--configure.in4
-rw-r--r--libsylph/procheader.c33
-rw-r--r--libsylph/procmime.c28
-rw-r--r--libsylph/procmime.h1
-rw-r--r--libsylph/procmsg.h4
-rw-r--r--src/icons/Makefile.am4
-rw-r--r--src/icons/html.pngbin0 -> 770 bytes
-rw-r--r--src/stock_pixmap.c2
-rw-r--r--src/stock_pixmap.h1
-rw-r--r--src/summaryview.c9
11 files changed, 89 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index a86fbae8..f2155a6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-09-13
+
+ * libsylph/procheader.c
+ libsylph/procmsg.h
+ libsylph/procmime.[ch]
+ src/icons/html.png
+ src/icons/Makefile.am
+ src/stock_pixmap.[ch]
+ src/summaryview.c: distinguish icon for HTML mail and other mail
+ with attachments on summaryview (#84) (Thanks to Hayashi).
+
2013-09-11
* src/quick_search.[ch]
diff --git a/configure.in b/configure.in
index 4094c954..11e0e9ec 100644
--- a/configure.in
+++ b/configure.in
@@ -9,8 +9,8 @@ MINOR_VERSION=4
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=beta5
-BUILD_REVISION=1149
+EXTRA_VERSION=beta6
+BUILD_REVISION=1150
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl define if this is a development release
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;
diff --git a/libsylph/procmime.c b/libsylph/procmime.c
index e2c7fdb4..9c5020a2 100644
--- a/libsylph/procmime.c
+++ b/libsylph/procmime.c
@@ -210,6 +210,34 @@ MimeInfo *procmime_scan_message(MsgInfo *msginfo)
return mimeinfo;
}
+MimeInfo *procmime_scan_message_stream(FILE *fp)
+{
+ MimeInfo *mimeinfo;
+ glong fpos;
+
+ g_return_val_if_fail(fp != NULL, NULL);
+
+ if (fseek(fp, 0L, SEEK_SET) < 0) {
+ FILE_OP_ERROR("procmime_scan_message_stream()", "fseek");
+ return NULL;
+ }
+
+ mimeinfo = procmime_scan_mime_header(fp);
+
+ if (mimeinfo) {
+ fpos = ftell(fp);
+ mimeinfo->content_size = get_left_file_size(fp);
+ mimeinfo->size = fpos + mimeinfo->content_size;
+ if (mimeinfo->encoding_type == ENC_BASE64)
+ mimeinfo->content_size = mimeinfo->content_size / 4 * 3;
+ if (mimeinfo->mime_type == MIME_MULTIPART ||
+ mimeinfo->mime_type == MIME_MESSAGE_RFC822)
+ procmime_scan_multipart_message(mimeinfo, fp);
+ }
+
+ return mimeinfo;
+}
+
void procmime_scan_multipart_message(MimeInfo *mimeinfo, FILE *fp)
{
gchar *p;
diff --git a/libsylph/procmime.h b/libsylph/procmime.h
index a439ed1e..1247601d 100644
--- a/libsylph/procmime.h
+++ b/libsylph/procmime.h
@@ -142,6 +142,7 @@ void procmime_mimeinfo_replace (MimeInfo *old,
MimeInfo *procmime_mimeinfo_next (MimeInfo *mimeinfo);
MimeInfo *procmime_scan_message (MsgInfo *msginfo);
+MimeInfo *procmime_scan_message_stream (FILE *fp);
void procmime_scan_multipart_message (MimeInfo *mimeinfo,
FILE *fp);
diff --git a/libsylph/procmsg.h b/libsylph/procmsg.h
index 92a6be8b..a309bc8d 100644
--- a/libsylph/procmsg.h
+++ b/libsylph/procmsg.h
@@ -89,13 +89,14 @@ typedef guint32 MsgPermFlags;
#define MSG_IMAP (1U << 19)
#define MSG_NEWS (1U << 20)
#define MSG_SIGNED (1U << 21)
+#define MSG_MIME_HTML (1U << 26)
#define MSG_FLAG_CHANGED (1U << 27)
#define MSG_CACHED (1U << 28)
#define MSG_MIME (1U << 29)
#define MSG_INVALID (1U << 30)
#define MSG_RECEIVED (1U << 31)
-#define MSG_CACHED_FLAG_MASK (MSG_MIME)
+#define MSG_CACHED_FLAG_MASK (MSG_MIME|MSG_MIME_HTML)
typedef guint32 MsgTmpFlags;
@@ -131,6 +132,7 @@ typedef guint32 MsgTmpFlags;
#define MSG_IS_IMAP(msg) (((msg).tmp_flags & MSG_IMAP) != 0)
#define MSG_IS_NEWS(msg) (((msg).tmp_flags & MSG_NEWS) != 0)
#define MSG_IS_SIGNED(msg) (((msg).tmp_flags & MSG_SIGNED) != 0)
+#define MSG_IS_MIME_HTML(msg) (((msg).tmp_flags & MSG_MIME_HTML) != 0)
#define MSG_IS_FLAG_CHANGED(msg) (((msg).tmp_flags & MSG_FLAG_CHANGED) != 0)
#define MSG_IS_CACHED(msg) (((msg).tmp_flags & MSG_CACHED) != 0)
#define MSG_IS_MIME(msg) (((msg).tmp_flags & MSG_MIME) != 0)
diff --git a/src/icons/Makefile.am b/src/icons/Makefile.am
index c1ad743b..2c7cd17f 100644
--- a/src/icons/Makefile.am
+++ b/src/icons/Makefile.am
@@ -32,7 +32,8 @@ BUILT_SOURCES = \
folder-open.h \
folder-noselect.h \
folder-search.h \
- group.h
+ group.h \
+ html.h
EXTRA_DIST = \
stock_addressbook.png \
@@ -69,6 +70,7 @@ EXTRA_DIST = \
folder-noselect.png \
folder-search.png \
group.png \
+ html.png \
clip.xpm \
deleted.xpm \
forwarded.xpm \
diff --git a/src/icons/html.png b/src/icons/html.png
new file mode 100644
index 00000000..d95fcc09
--- /dev/null
+++ b/src/icons/html.png
Binary files differ
diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c
index 0da2155b..09d1df84 100644
--- a/src/stock_pixmap.c
+++ b/src/stock_pixmap.c
@@ -80,6 +80,7 @@
#include "icons/folder-noselect.h"
#include "icons/folder-search.h"
#include "icons/group.h"
+#include "icons/html.h"
typedef struct _StockPixmapData StockPixmapData;
@@ -110,6 +111,7 @@ static StockPixmapData pixmaps[] =
{error_xpm , NULL, NULL},
{forwarded_xpm , NULL, NULL},
{NULL, NULL, NULL, NULL, group, sizeof(group), "group", 0},
+ {NULL, NULL, NULL, NULL, html, sizeof(html), "html", 0},
{interface_xpm , NULL, NULL},
{jpilot_xpm , NULL, NULL},
{ldap_xpm , NULL, NULL},
diff --git a/src/stock_pixmap.h b/src/stock_pixmap.h
index a7c6d392..7d019510 100644
--- a/src/stock_pixmap.h
+++ b/src/stock_pixmap.h
@@ -38,6 +38,7 @@ typedef enum
STOCK_PIXMAP_ERROR,
STOCK_PIXMAP_FORWARDED,
STOCK_PIXMAP_GROUP,
+ STOCK_PIXMAP_HTML,
STOCK_PIXMAP_INTERFACE,
STOCK_PIXMAP_JPILOT,
STOCK_PIXMAP_LDAP,
diff --git a/src/summaryview.c b/src/summaryview.c
index dc2fb50b..bac678f1 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -139,6 +139,7 @@ static GdkPixbuf *replied_pixbuf;
static GdkPixbuf *forwarded_pixbuf;
static GdkPixbuf *clip_pixbuf;
+static GdkPixbuf *html_pixbuf;
static void summary_clear_list_full (SummaryView *summaryview,
gboolean is_refresh);
@@ -624,6 +625,8 @@ void summary_init(SummaryView *summaryview)
&forwarded_pixbuf);
stock_pixbuf_gdk(summaryview->treeview, STOCK_PIXMAP_CLIP,
&clip_pixbuf);
+ stock_pixbuf_gdk(summaryview->treeview, STOCK_PIXMAP_HTML,
+ &html_pixbuf);
font_desc = pango_font_description_new();
size = pango_font_description_get_size
@@ -2473,8 +2476,12 @@ static void summary_set_row(SummaryView *summaryview, GtkTreeIter *iter,
else if (MSG_IS_FORWARDED(flags))
unread_pix = forwarded_pixbuf;
- if (MSG_IS_MIME(flags))
+ if (MSG_IS_MIME(flags)) {
mime_pix = clip_pixbuf;
+ }
+ if (MSG_IS_MIME_HTML(flags)) {
+ mime_pix = html_pixbuf;
+ }
if (prefs_common.bold_unread) {
if (MSG_IS_UNREAD(flags))