2005-03-04 [paul] 1.0.1cvs21
[claws.git] / src / procmime.c
index 42c3f9257206723df83db45ba7428658d7440a1e..0cc98441638f557f1b4eb5cf8d55cee0a76d6486 100644 (file)
@@ -228,9 +228,14 @@ MimeInfo *procmime_scan_message(MsgInfo *msginfo)
        gchar *filename;
        MimeInfo *mimeinfo;
 
-       filename = procmsg_get_message_file(msginfo);
-       if (!filename)
+       filename = procmsg_get_message_file_path(msginfo);
+       if (!filename || !is_file_exist(filename)) {
+               g_free(filename);
+               filename = procmsg_get_message_file(msginfo);
+       }
+       if (!filename || !is_file_exist(filename)) 
                return NULL;
+
        if (msginfo->folder->stype != F_QUEUE && 
            msginfo->folder->stype != F_DRAFT)
                mimeinfo = procmime_scan_file(filename);
@@ -475,7 +480,16 @@ gboolean procmime_encode_content(MimeInfo *mimeinfo, EncodingType encoding)
 
                while (fgets(inbuf, sizeof(inbuf), infp) != NULL) {
                        qp_encode_line(outbuf, inbuf);
-                       fputs(outbuf, outfp);
+
+                       if (!strncmp("From ", outbuf, sizeof("From ")-1)) {
+                               gchar *tmpbuf = outbuf;
+                               
+                               tmpbuf += sizeof("From ")-1;
+                               
+                               fputs("=46rom ", outfp);
+                               fputs(tmpbuf, outfp);
+                       } else 
+                               fputs(outbuf, outfp);
                }
        } else {
                gchar buf[BUFFSIZE];
@@ -1209,6 +1223,7 @@ void procmime_parse_message_rfc822(MimeInfo *mimeinfo)
                                {NULL,             NULL, FALSE}};
        guint content_start, i;
        FILE *fp;
+       gchar buf[BUFFSIZE];
        gint mime_major, mime_minor;
 
        procmime_decode_content(mimeinfo);
@@ -1221,11 +1236,14 @@ void procmime_parse_message_rfc822(MimeInfo *mimeinfo)
        fseek(fp, mimeinfo->offset, SEEK_SET);
        procheader_get_header_fields(fp, hentry);
        if (hentry[0].body != NULL)
-               conv_unmime_header_overwrite(hentry[0].body);
+               conv_unmime_header(buf, sizeof(buf), hentry[0].body,
+                                  NULL);
        if (hentry[2].body != NULL)
-               conv_unmime_header_overwrite(hentry[2].body);
+               conv_unmime_header(buf, sizeof(buf), hentry[2].body,
+                                  NULL);
        if (hentry[4].body != NULL)
-               conv_unmime_header_overwrite(hentry[4].body);
+               conv_unmime_header(buf, sizeof(buf), hentry[4].body,
+                                  NULL);
        content_start = ftell(fp);
        fclose(fp);
 
@@ -1313,11 +1331,14 @@ void procmime_parse_multipart(MimeInfo *mimeinfo)
                        }
                        procheader_get_header_fields(fp, hentry);
                        if (hentry[0].body != NULL)
-                               conv_unmime_header_overwrite(hentry[0].body);
+                               conv_unmime_header(buf, sizeof(buf), hentry[0].body,
+                               NULL);
                        if (hentry[2].body != NULL)
-                               conv_unmime_header_overwrite(hentry[2].body);
+                               conv_unmime_header(buf, sizeof(buf), hentry[2].body,
+                               NULL);
                        if (hentry[4].body != NULL)
-                               conv_unmime_header_overwrite(hentry[4].body);
+                               conv_unmime_header(buf, sizeof(buf), hentry[4].body,
+                               NULL);
                        lastoffset = ftell(fp);
                }
        }