aboutsummaryrefslogtreecommitdiff
path: root/src/compose.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-02-24 06:04:58 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-02-24 06:04:58 +0000
commit3b3d146cfba6e51982f93884bcedbfd43b65a54d (patch)
treeb8cfbc006aae596ca02101ec7e278c3d15816df1 /src/compose.c
parent2cc9146cfb6ecee1257317bbee17987a78b22611 (diff)
force transfer encoding of attachments for PGP.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@124 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/compose.c')
-rw-r--r--src/compose.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/compose.c b/src/compose.c
index c4f5663f..15dca3ad 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -2979,6 +2979,7 @@ static void compose_write_attach(Compose *compose, FILE *fp)
FILE *attach_fp;
gchar filename[BUFFSIZE];
gint len;
+ EncodingType encoding;
for (row = 0; (ainfo = gtk_clist_get_row_data(clist, row)) != NULL;
row++) {
@@ -3002,10 +3003,22 @@ static void compose_write_attach(Compose *compose, FILE *fp)
" filename=\"%s\"\n", filename);
}
+ encoding = ainfo->encoding;
+
+#if USE_GPGME
+ /* force encoding to protect trailing spaces */
+ if (compose->use_signing) {
+ if (encoding == ENC_7BIT)
+ encoding = ENC_QUOTED_PRINTABLE;
+ else if (encoding == ENC_8BIT)
+ encoding = ENC_BASE64;
+ }
+#endif
+
fprintf(fp, "Content-Transfer-Encoding: %s\n\n",
- procmime_get_encoding_str(ainfo->encoding));
+ procmime_get_encoding_str(encoding));
- if (ainfo->encoding == ENC_BASE64) {
+ if (encoding == ENC_BASE64) {
gchar inbuf[B64_LINE_SIZE], outbuf[B64_BUFFSIZE];
FILE *tmp_fp = attach_fp;
gchar *tmp_file = NULL;
@@ -3049,7 +3062,7 @@ static void compose_write_attach(Compose *compose, FILE *fp)
unlink(tmp_file);
g_free(tmp_file);
}
- } else if (ainfo->encoding == ENC_QUOTED_PRINTABLE) {
+ } else if (encoding == ENC_QUOTED_PRINTABLE) {
gchar inbuf[BUFFSIZE], outbuf[BUFFSIZE * 4];
while (fgets(inbuf, sizeof(inbuf), attach_fp) != NULL) {