diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2010-08-10 06:36:37 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2010-08-10 06:36:37 +0000 |
commit | fffb52505d0ee97613dd29355a8ae95f24038c98 (patch) | |
tree | 46136995eea81922b5ebb1fb34a1a101438e6834 /plugin | |
parent | 5a02f159c842e5785373ae08b5dd622b1329e430 (diff) |
attachment_tool.c: skip multipart messages without attachments.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2667 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/attachment_tool/attachment_tool.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/plugin/attachment_tool/attachment_tool.c b/plugin/attachment_tool/attachment_tool.c index def873a3..32ea4dd4 100644 --- a/plugin/attachment_tool/attachment_tool.c +++ b/plugin/attachment_tool/attachment_tool.c @@ -172,6 +172,16 @@ static gboolean remove_attachment_rec(MimeInfo *partinfo, FILE *fp, FILE *outfp) return !err; } +static gboolean has_attach_part(MimeInfo *mimeinfo) +{ + for (; mimeinfo != NULL; mimeinfo = procmime_mimeinfo_next(mimeinfo)) { + if (mimeinfo->filename || mimeinfo->name) + return TRUE; + } + + return FALSE; +} + static gboolean remove_attachment(MsgInfo *msginfo) { MimeInfo *mimeinfo; @@ -182,6 +192,12 @@ static gboolean remove_attachment(MsgInfo *msginfo) mimeinfo = procmime_scan_message(msginfo); g_return_val_if_fail(mimeinfo != NULL, FALSE); + if (!has_attach_part(mimeinfo)) { + debug_print("remove_attachment: this message doesn't have attachments\n"); + procmime_mimeinfo_free_all(mimeinfo); + return TRUE; + } + if ((fp = procmsg_open_message(msginfo)) == NULL) { procmime_mimeinfo_free_all(mimeinfo); return FALSE; |