2004-12-09 [colin] 0.9.13cvs10
authorColin Leroy <colin@colino.net>
Thu, 9 Dec 2004 09:30:30 +0000 (09:30 +0000)
committerColin Leroy <colin@colino.net>
Thu, 9 Dec 2004 09:30:30 +0000 (09:30 +0000)
* src/procmime.c
Fix procmime_encode_content doing horribly wrong
stuff when encoding to B64 from memory

ChangeLog.claws
PATCHSETS
configure.ac
src/procmime.c

index cf053b0..ce08f3a 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-09 [colin]     0.9.13cvs10
+
+       * src/procmime.c
+               Fix procmime_encode_content doing horribly wrong
+               stuff when encoding to B64 from memory
+
 2004-12-08 [colin]     0.9.13cvs9
 
        * src/gtk/colorlabel.c
index b6b532c..01d77ac 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.36 -r 1.37 src/matcher_parser_parse.y; cvs diff -u -r 1.28 -r 1.29 src/msgcache.c; cvs diff -u -r 1.48 -r 1.49 src/prefs_matcher.c; cvs diff -u -r 1.60 -r 1.61 src/procheader.c; cvs diff -u -r 1.88 -r 1.89 src/matcher.c; cvs diff -u -r 1.17 -r 1.18 src/common/defs.h; ) > 0.9.13cvs7.patchset
 ( cvs diff -u -r 1.26 -r 1.27 src/quote_fmt_parse.y ) > 0.9.13cvs8.patchset
 ( cvs diff -u -r 1.4 -r 1.5 src/gtk/colorlabel.c; ) > 0.9.13cvs9.patchset
+( cvs diff -u -r 1.100 -r 1.101 src/procmime.c; ) > 0.9.13cvs10.patchset
index 422bf4d..4ec0b82 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=13
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=9
+EXTRA_VERSION=10
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index b035ab2..bb6d462 100644 (file)
@@ -428,16 +428,27 @@ gboolean procmime_encode_content(MimeInfo *mimeinfo, EncodingType encoding)
 
                if (mimeinfo->type == MIMETYPE_TEXT ||
                    mimeinfo->type == MIMETYPE_MESSAGE) {
-                       tmp_file = get_tmp_file();
-                       if (canonicalize_file(mimeinfo->data.filename, tmp_file) < 0) {
-                               g_free(tmp_file);
-                               fclose(infp);
-                       }
-                       if ((tmp_fp = fopen(tmp_file, "rb")) == NULL) {
-                               FILE_OP_ERROR(tmp_file, "fopen");
-                               unlink(tmp_file);
-                               g_free(tmp_file);
+                       if (mimeinfo->content == MIMECONTENT_FILE) {
+                               tmp_file = get_tmp_file();
+                               if (canonicalize_file(mimeinfo->data.filename, tmp_file) < 0) {
+                                       g_free(tmp_file);
+                                       fclose(infp);
+                                       return FALSE;
+                               }
+                               if ((tmp_fp = fopen(tmp_file, "rb")) == NULL) {
+                                       FILE_OP_ERROR(tmp_file, "fopen");
+                                       unlink(tmp_file);
+                                       g_free(tmp_file);
+                                       fclose(infp);
+                                       return FALSE;
+                               }
+                       } else {
+                               gchar *out = canonicalize_str(mimeinfo->data.mem);
                                fclose(infp);
+                               tmp_fp = infp = str_open_as_stream(out);
+                               g_free(out);
+                               if (infp == NULL)
+                                       return FALSE;
                        }
                }
 
@@ -458,7 +469,7 @@ gboolean procmime_encode_content(MimeInfo *mimeinfo, EncodingType encoding)
                        fclose(tmp_fp);
                        unlink(tmp_file);
                        g_free(tmp_file);
-               }
+               } 
        } else if (encoding == ENC_QUOTED_PRINTABLE) {
                gchar inbuf[BUFFSIZE], outbuf[BUFFSIZE * 4];