[gmime] Updated g_mime_text_part_set_text() to set an appropriate transfer encoding
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Updated g_mime_text_part_set_text() to set an appropriate transfer encoding
- Date: Sat, 11 Mar 2017 19:20:45 +0000 (UTC)
commit 5264eb8bccd64152edd78d9583067a7d1d90e112
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date: Sat Mar 11 12:33:18 2017 -0500
Updated g_mime_text_part_set_text() to set an appropriate transfer encoding
gmime/gmime-text-part.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gmime/gmime-text-part.c b/gmime/gmime-text-part.c
index cb1243b..cc63b9f 100644
--- a/gmime/gmime-text-part.c
+++ b/gmime/gmime-text-part.c
@@ -203,6 +203,7 @@ g_mime_text_part_set_text (GMimeTextPart *mime_part, const char *text)
{
GMimeContentType *content_type;
GMimeStream *filtered, *stream;
+ GMimeContentEncoding encoding;
GMimeDataWrapper *content;
GMimeFilter *filter;
const char *charset;
@@ -244,6 +245,18 @@ g_mime_text_part_set_text (GMimeTextPart *mime_part, const char *text)
g_mime_part_set_content ((GMimePart *) mime_part, content);
g_object_unref (content);
+
+ encoding = g_mime_part_get_content_encoding ((GMimePart *) mime_part);
+
+ /* if the user has already specified encoding the content with base64/qp/uu, don't change it */
+ if (encoding > GMIME_CONTENT_ENCODING_BINARY)
+ return;
+
+ /* ...otherwise, set an appropriate Content-Transfer-Encoding based on the text provided... */
+ if (mask.level > 0)
+ g_mime_part_set_content_encoding ((GMimePart *) mime_part, GMIME_CONTENT_ENCODING_8BIT);
+ else
+ g_mime_part_set_content_encoding ((GMimePart *) mime_part, GMIME_CONTENT_ENCODING_7BIT);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]