2004-08-23 [colin] 0.9.12cvs78
authorColin Leroy <colin@colino.net>
Mon, 23 Aug 2004 12:08:45 +0000 (12:08 +0000)
committerColin Leroy <colin@colino.net>
Mon, 23 Aug 2004 12:08:45 +0000 (12:08 +0000)
* src/rfc2015.c
* src/rfc2015.h
* src/compose.c
Fix (again) bug 197: inline encryption broken

ChangeLog.claws
PATCHSETS
configure.ac
src/compose.c
src/rfc2015.c
src/rfc2015.h

index 200f09524a0a5299933ce1f2a20222e8403289a3..be7949b3cc06e806dfccbde100ed03d0cfb72058 100644 (file)
@@ -1,3 +1,10 @@
+2004-08-23 [colin]     0.9.12cvs78
+
+       * src/rfc2015.c
+       * src/rfc2015.h
+       * src/compose.c
+               Fix (again) bug 197: inline encryption broken
+
 2004-08-23 [paul]
 
        * po/zh_CN.po
index 812907e925a166df3d40dbbe3dd72987de79da2f..6603f4b7254e58a590d45982639256ca85c0a87f 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
@@ -60,3 +60,4 @@
 ( cvs diff -u -r 1.1 -r 1.2 m4/Makefile.am; ) > 0.9.12cvs75.patchset
 ( cvs diff -u -r 1.15 -r 1.16 src/plugins/trayicon/trayicon.c; ) > 0.9.12cvs76.patchset
 ( cvs diff -u -r 1.205 -r 1.206 src/imap.c; ) > 0.9.12cvs77.patchset
+( cvs diff -u -r 1.41 -r 1.42 src/rfc2015.c; cvs diff -u -r 1.8 -r 1.9 src/rfc2015.h; cvs diff -u -r 1.438 -r 1.439 src/compose.c; ) > 0.9.12cvs78.patchset
index 155ffd5349663777c264bdd877d6cfc6c5dc4043..999ba01c0254dc0b30725b4efd22ab3dcccadc5a 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=12
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=77
+EXTRA_VERSION=78
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index f2c061d2d5f4cc8c19f46b422e7c030145383dda..c5430fdcf851592574b9197d3f81bbf95155d004 100644 (file)
@@ -3780,7 +3780,8 @@ static gint compose_write_to_file(Compose *compose, const gchar *file,
        }
        if (compose->use_encryption) {
                if (rfc2015_encrypt(file, compose->to_list,
-                                   compose->gnupg_mode) < 0) {
+                                   compose->gnupg_mode,
+                                   out_codeset) < 0) {
                        unlink(file);
                        return -1;
                }
index 2502be61cc0baba22fc02f09fe050e1542cb6d9f..13b212ccb2295eed4f8ab24362b9de993f4c1be8 100644 (file)
@@ -233,7 +233,8 @@ leave:
  * encryption keys for all of them.  The file content is then replaced
  * by the encrypted one.  */
 int
-rfc2015_encrypt (const char *file, GSList *recp_list, gboolean ascii_armored)
+rfc2015_encrypt (const char *file, GSList *recp_list, gboolean ascii_armored,
+                const gchar *out_codeset)
 {
     FILE *fp = NULL;
     char buf[BUFFSIZE];
@@ -285,6 +286,7 @@ rfc2015_encrypt (const char *file, GSList *recp_list, gboolean ascii_armored)
             saved_last = 1;
             continue;
         }
+
         if (saved_last) {
             if (*buf == ' ' || *buf == '\t') {
                 char *last = clines[clineidx - 1];
@@ -300,7 +302,8 @@ rfc2015_encrypt (const char *file, GSList *recp_list, gboolean ascii_armored)
 
         if (buf[0] == '\r' || buf[0] == '\n')
             break;
-        err = gpgme_data_write (header, buf, strlen (buf));
+       
+       err = gpgme_data_write (header, buf, strlen (buf));
     }
     if (ferror (fp)) {
         FILE_OP_ERROR (file, "fgets");
@@ -310,10 +313,12 @@ rfc2015_encrypt (const char *file, GSList *recp_list, gboolean ascii_armored)
     /* write them to the temp data and add the rest of the message */
     for (i = 0; !err && i < clineidx; i++) {
         debug_print ("%% %s:%d: cline=`%s'", __FILE__ ,__LINE__, clines[i]);
-        err = gpgme_data_write (plain, clines[i], strlen (clines[i]));
+       if (!ascii_armored)
+               err = gpgme_data_write (plain, clines[i], strlen (clines[i]));
     }
-    if (!err)
+    if (!err && !ascii_armored)
         err = gpgme_data_write (plain, "\r\n", 2);
+
     while (!err && fgets(buf, sizeof(buf), fp)) {
         err = gpgme_data_write (plain, buf, strlen (buf));
     }
@@ -376,9 +381,10 @@ rfc2015_encrypt (const char *file, GSList *recp_list, gboolean ascii_armored)
 
     if (ascii_armored) {
         fprintf(fp, 
-            "Content-Type: text/plain; charset=US-ASCII\r\n"
-            "Content-Transfer-Encoding: 7bit\r\n"  
-            "\r\n");
+            "Content-Type: text/plain; charset=%s\r\n"
+            "Content-Disposition: inline\r\n"  
+            "Content-Transfer-Encoding: 8bit\r\n"  
+            "\r\n", out_codeset ? out_codeset : CS_US_ASCII);
     } else {
         fprintf (fp,
                "Content-Type: multipart/encrypted;"
index 04523195b954ac2b98c3ced69953ad236756b554..3c14a4b2e2b5a73c65b18462459ee85e832eb2a4 100644 (file)
@@ -42,7 +42,8 @@ void rfc2015_decrypt_message          (MsgInfo        *msginfo,
 GSList *rfc2015_create_signers_list    (const gchar    *keyid);
 gint rfc2015_encrypt                   (const gchar    *file,
                                         GSList         *recp_list,
-                                        gboolean        ascii_armored);
+                                        gboolean        ascii_armored,
+                                        const gchar    *out_codeset);
 gint rfc2015_sign                      (const gchar    *file,
                                         GSList         *key_list);
 gint rfc2015_clearsign                 (const gchar    *file,