From de180f6cbbabda73d445f802e83e12696bffdab6 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 11 Jul 2002 22:30:51 +0000 Subject: Fixes bug #27672 2002-07-11 Jeffrey Stedfast Fixes bug #27672 * camel-mime-filter-bestenc.c: Conditionally #include * camel-mime-filter-linewrap.c: Same here... although we could probably just get rid of this filter? We don't seem to use it anywhere since we try to QP/Base64 encode any text parts with long lines. Besides, we couldn't use this filter for SMTP anyway since we can't risk possibly linewrapping a binary mime part. I dunno, maybe this could be useful in the composer though? *shrug* * providers/smtp/camel-smtp-transport.c (smtp_data): Always call camel_mime_message_set_best_encoding() even if the server allows 8BITMIME and even if we don't have any 8bit parts because we may have parts with long lines (>998 octets) which also need to be encoded. * camel-mime-message.c (check_8bit): Don't forget to check for the binary encoding here as well. svn path=/trunk/; revision=17428 --- camel/ChangeLog | 22 ++++++++++++++++++++++ camel/camel-mime-filter-bestenc.c | 5 +++++ camel/camel-mime-filter-linewrap.c | 7 +++++++ camel/camel-mime-message.c | 6 +++++- camel/providers/smtp/camel-smtp-transport.c | 17 ++++++++++++----- 5 files changed, 51 insertions(+), 6 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index b546c95d6e..5812a37b84 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,25 @@ +2002-07-11 Jeffrey Stedfast + + Fixes bug #27672 + + * camel-mime-filter-bestenc.c: Conditionally #include + + * camel-mime-filter-linewrap.c: Same here... although we could + probably just get rid of this filter? We don't seem to use it + anywhere since we try to QP/Base64 encode any text parts with long + lines. Besides, we couldn't use this filter for SMTP anyway since + we can't risk possibly linewrapping a binary mime part. I dunno, + maybe this could be useful in the composer though? *shrug* + + * providers/smtp/camel-smtp-transport.c (smtp_data): Always call + camel_mime_message_set_best_encoding() even if the server allows + 8BITMIME and even if we don't have any 8bit parts because we may + have parts with long lines (>998 octets) which also need to be + encoded. + + * camel-mime-message.c (check_8bit): Don't forget to check for the + binary encoding here as well. + 2002-07-11 Jeffrey Stedfast * providers/imap/camel-imap-folder.c (parse_fetch_response): If we diff --git a/camel/camel-mime-filter-bestenc.c b/camel/camel-mime-filter-bestenc.c index e53923344b..0de8abd04b 100644 --- a/camel/camel-mime-filter-bestenc.c +++ b/camel/camel-mime-filter-bestenc.c @@ -18,6 +18,11 @@ * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include "camel-mime-filter-bestenc.h" diff --git a/camel/camel-mime-filter-linewrap.c b/camel/camel-mime-filter-linewrap.c index 44d4755efb..c9a741dacf 100644 --- a/camel/camel-mime-filter-linewrap.c +++ b/camel/camel-mime-filter-linewrap.c @@ -19,9 +19,16 @@ * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include + #include "camel-mime-filter-linewrap.h" + static void filter (CamelMimeFilter *f, char *in, size_t len, size_t prespace, char **out, size_t *outlen, size_t *outprespace); static void complete (CamelMimeFilter *f, char *in, size_t len, diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c index fe62c84ed5..0b21d98a57 100644 --- a/camel/camel-mime-message.c +++ b/camel/camel-mime-message.c @@ -660,10 +660,14 @@ camel_mime_message_foreach_part (CamelMimeMessage *msg, CamelPartFunc callback, static gboolean check_8bit (CamelMimeMessage *msg, CamelMimePart *part, void *data) { + CamelMimePartEncodingType encoding; int *has8bit = data; /* check this part, and stop as soon as we are done */ - *has8bit = camel_mime_part_get_encoding (part) == CAMEL_MIME_PART_ENCODING_8BIT; + encoding = camel_mime_part_get_encoding (part); + + *has8bit = encoding == CAMEL_MIME_PART_ENCODING_8BIT || encoding == CAMEL_MIME_PART_ENCODING_BINARY; + return !(*has8bit); } diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 7e5eddb6a0..b2b31bb922 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -39,7 +39,6 @@ #undef MIN #undef MAX #include "camel-mime-filter-crlf.h" -#include "camel-mime-filter-linewrap.h" #include "camel-stream-filter.h" #include "camel-smtp-transport.h" #include "camel-mime-message.h" @@ -1137,6 +1136,8 @@ static gboolean smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, gboolean has_8bit_parts, CamelException *ex) { /* now we can actually send what's important :p */ + CamelBestencRequired required = CAMEL_BESTENC_GET_ENCODING; + CamelBestencEncoding enctype = CAMEL_BESTENC_BINARY; char *cmdbuf, *respbuf = NULL; CamelStreamFilter *filtered_stream; CamelMimeFilter *crlffilter; @@ -1144,11 +1145,17 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, gboolean ha GSList *h, *bcc = NULL; int ret; - /* if the message contains 8bit mime parts and the server - doesn't support it, encode 8bit parts to the best - encoding. This will also enforce an encoding to keep the lines in limit */ + /* if the message contains 8bit/binary mime parts and the server + doesn't support it, set our required encoding to be 7bit */ if (has_8bit_parts && !(transport->flags & CAMEL_SMTP_TRANSPORT_8BITMIME)) - camel_mime_message_encode_8bit_parts (message); + enctype = CAMEL_BESTENC_7BIT; + + /* FIXME: should we get the best charset too?? */ + /* Changes the encoding of any 8bit/binary mime parts to fit + within our required encoding type and also force any text + parts with long lines (longer than 998 octets) to wrap by + QP or base64 encoding them. */ + camel_mime_message_set_best_encoding (message, required, enctype); cmdbuf = g_strdup ("DATA\r\n"); -- cgit v1.2.3