g_free(mimeinfo->boundary);
g_free(mimeinfo->content_disposition);
g_free(mimeinfo->filename);
+ g_free(mimeinfo->description);
#if USE_GPGME
g_free(mimeinfo->plaintextfile);
g_free(mimeinfo->sigstatus);
while ((p = fgets(buf, sizeof(buf), fp)) != NULL)
if (IS_BOUNDARY(buf, boundary, boundary_len)) break;
if (!p) return;
+ } else if (mimeinfo->parent && mimeinfo->parent->boundary) {
+ boundary = mimeinfo->parent->boundary;
+ boundary_len = strlen(boundary);
}
if ((fpos = ftell(fp)) < 0) {
for (;;) {
MimeInfo *partinfo;
gboolean eom = FALSE;
+ gint len;
prev_fpos = fpos;
debug_print("prev_fpos: %ld\n", fpos);
partinfo = procmime_scan_mime_header(fp);
if (!partinfo) break;
procmime_mimeinfo_insert(mimeinfo, partinfo);
+ debug_print("content-type: %s\n",
+ partinfo->content_type);
}
if (partinfo->mime_type == MIME_MULTIPART ||
buf[0] = '\0';
eom = TRUE;
}
+ debug_print("boundary: %s\n", buf);
+
fpos = ftell(fp);
debug_print("fpos: %ld\n", fpos);
- partinfo->size = fpos - prev_fpos - strlen(buf);
+ len = strlen(buf);
+ partinfo->size = fpos - prev_fpos - len;
debug_print("partinfo->size: %d\n", partinfo->size);
if (partinfo->sub && !partinfo->sub->sub &&
!partinfo->sub->children) {
debug_print("partinfo->sub->size: %d\n",
partinfo->sub->size);
}
- debug_print("boundary: %s\n", buf);
+
+ if (mimeinfo->mime_type == MIME_MESSAGE_RFC822) {
+ if (len > 0 && fseek(fp, fpos - len, SEEK_SET) < 0)
+ perror("fseek");
+ break;
+ }
if (eom) break;
}
dup2(oldout, 1);
} else if (mimeinfo->mime_type == MIME_TEXT) {
while (fgets(buf, sizeof(buf), tmpfp) != NULL) {
- str = conv_codeset_strdup(buf, src_codeset, NULL);
+#warning FIXME_GTK2
+ str = conv_codeset_strdup(buf, src_codeset, CS_UTF_8);
if (str) {
fputs(str, outfp);
g_free(str);
gchar *procmime_get_tmp_file_name(MimeInfo *mimeinfo)
{
static guint32 id = 0;
- gchar *base;
+ const gchar *base;
gchar *filename;
gchar f_prefix[10];
if (MIME_TEXT_HTML == mimeinfo->mime_type)
base = "mimetmp.html";
else {
+ gchar *tmp;
base = mimeinfo->filename ? mimeinfo->filename
: mimeinfo->name ? mimeinfo->name : "mimetmp";
base = g_basename(base);
if (*base == '\0') base = "mimetmp";
- Xstrdup_a(base, base, return NULL);
- subst_for_filename(base);
+ Xstrdup_a(tmp, base, return NULL);
+ subst_for_filename(tmp);
+ base = tmp;
}
filename = g_strconcat(get_mime_tmp_dir(), G_DIR_SEPARATOR_S,