From 8fccb4d7124950d72a1a12d763e9b0c7835b019d Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Mon, 14 Feb 2005 20:03:49 +0000 Subject: [PATCH 1/1] 2005-02-14 [colin] 1.0.1cvs6 * src/compose.c * src/procmime.c Use quoted-printable instead of 7bit or 8bit to encode "^From " and avoid mail corruption on the MTA, as specified by RFC 3156. Thanks Hoa for the hint. --- ChangeLog.claws | 9 +++++++++ PATCHSETS | 1 + configure.ac | 2 +- src/compose.c | 8 ++++++++ src/procmime.c | 11 ++++++++++- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index 44c59266d..073a6eb27 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,12 @@ +2005-02-14 [colin] 1.0.1cvs6 + + * src/compose.c + * src/procmime.c + Use quoted-printable instead of 7bit or 8bit + to encode "^From " and avoid mail corruption + on the MTA, as specified by RFC 3156. Thanks + Hoa for the hint. + 2005-02-12 [colin] 1.0.1cvs5 * src/filtering.c diff --git a/PATCHSETS b/PATCHSETS index 08d5007f9..bc3f5c4a7 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -243,3 +243,4 @@ ( cvs diff -u -r 1.473 -r 1.474 src/compose.c; ) > 1.0.1cvs4.patchset ( cvs diff -u -r 1.71 -r 1.72 src/filtering.c; ) > 1.0.1cvs5.patchset +( cvs diff -u -r 1.474 -r 1.475 src/compose.c; cvs diff -u -r 1.103 -r 1.104 src/procmime.c; ) > 1.0.1cvs6.patchset diff --git a/configure.ac b/configure.ac index 1914a672e..e2326f295 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=0 MICRO_VERSION=1 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=5 +EXTRA_VERSION=6 EXTRA_RELEASE= if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then diff --git a/src/compose.c b/src/compose.c index b4d0ae1b2..4c7a3cf68 100644 --- a/src/compose.c +++ b/src/compose.c @@ -3427,6 +3427,7 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action) if (action == COMPOSE_WRITE_FOR_SEND) { buf = conv_codeset_strdup(chars, src_codeset, out_codeset); + if (!buf) { AlertValue aval; gchar *msg; @@ -3455,6 +3456,13 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action) } g_free(chars); + if (encoding == ENC_8BIT || encoding == ENC_7BIT) { + if (!strncmp(buf, "From ", strlen("From ")) || + strstr(buf, "\nFrom ") != NULL) { + encoding = ENC_QUOTED_PRINTABLE; + } + } + mimetext = procmime_mimeinfo_new(); mimetext->content = MIMECONTENT_MEM; mimetext->data.mem = buf; diff --git a/src/procmime.c b/src/procmime.c index 64910e192..0ed8a0775 100644 --- a/src/procmime.c +++ b/src/procmime.c @@ -480,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, strlen("From "))) { + gchar *tmpbuf = outbuf; + + tmpbuf += strlen("From "); + + fputs("=46rom ", outfp); + fputs(tmpbuf, outfp); + } else + fputs(outbuf, outfp); } } else { gchar buf[BUFFSIZE]; -- 2.25.1