aboutsummaryrefslogtreecommitdiff
path: root/src/compose.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-12-25 06:39:13 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-12-25 06:39:13 +0000
commitdec23ffbb96d12b4097091b7fa5eda60e12bb816 (patch)
treecf3bef78d415b1127d646bd6ddef9638dda9dc82 /src/compose.c
parent64838d75e19b5c372128d3e82e1321962ee7de0c (diff)
attach all parts with filenames when forwarding.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@858 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/compose.c')
-rw-r--r--src/compose.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/src/compose.c b/src/compose.c
index 7bacb9c0..7cc78c65 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1970,14 +1970,6 @@ static void compose_attach_append(Compose *compose, const gchar *file,
-1);
}
-#define IS_FIRST_PART_TEXT(info) \
- ((info->mime_type == MIME_TEXT || info->mime_type == MIME_TEXT_HTML) || \
- (info->mime_type == MIME_MULTIPART && info->content_type && \
- !g_ascii_strcasecmp(info->content_type, "multipart/alternative") && \
- (info->children && \
- (info->children->mime_type == MIME_TEXT || \
- info->children->mime_type == MIME_TEXT_HTML))))
-
static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
{
MimeInfo *mimeinfo;
@@ -1988,41 +1980,34 @@ static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
mimeinfo = procmime_scan_message(msginfo);
if (!mimeinfo) return;
- /* skip first text (presumably message body) */
- child = mimeinfo->children;
- if (!child || IS_FIRST_PART_TEXT(mimeinfo)) {
- procmime_mimeinfo_free_all(mimeinfo);
- return;
- }
- if (IS_FIRST_PART_TEXT(child))
- child = child->next;
-
infile = procmsg_get_message_file_path(msginfo);
- while (child != NULL) {
- if (child->children || child->mime_type == MIME_MULTIPART) {
- child = procmime_mimeinfo_next(child);
+ for (child = mimeinfo; child != NULL;
+ child = procmime_mimeinfo_next(child)) {
+ if (child->children || child->mime_type == MIME_MULTIPART)
+ continue;
+ if (!child->filename && !child->name)
continue;
- }
outfile = procmime_get_tmp_file_name(child);
- if (procmime_get_part(outfile, infile, child) < 0)
+ if (procmime_get_part(outfile, infile, child) < 0) {
g_warning(_("Can't get the part of multipart message."));
- else
- compose_attach_append
- (compose, outfile,
- child->filename ? child->filename : child->name,
- child->content_type);
+ g_free(outfile);
+ continue;
+ }
- child = child->next;
+ compose_attach_append
+ (compose, outfile,
+ child->filename ? child->filename : child->name,
+ child->content_type);
+
+ g_free(outfile);
}
g_free(infile);
procmime_mimeinfo_free_all(mimeinfo);
}
-#undef IS_FIRST_PART_TEXT
-
#define INDENT_CHARS ">|#"
typedef enum {