[gmime] Allow apps to specify using only user-supplied charsets when encoding
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Allow apps to specify using only user-supplied charsets when encoding
- Date: Sat, 4 May 2013 12:27:03 +0000 (UTC)
commit 395c810dea6d8ea02c8dde306324848e0d8c62c9
Author: Jeffrey Stedfast <fejj gnome org>
Date: Sat May 4 08:26:12 2013 -0400
Allow apps to specify using only user-supplied charsets when encoding
2013-05-04 Jeffrey Stedfast <fejj gnome org>
* gmime/gmime-utils.c (rfc2047_encode): Respect the new
GMIME_ENABLE_USE_ONLY_USER_CHARSETS initialization flag.
* gmime/gmime.h: Define a new GMIME_ENABLE_USE_ONLY_USER_CHARSETS
initialization flag.
ChangeLog | 8 ++++++++
gmime/gmime-utils.c | 7 +++++--
gmime/gmime.c | 7 +++++++
gmime/gmime.h | 11 ++++++++++-
4 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 41c2040..0b5c845 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-05-04 Jeffrey Stedfast <fejj gnome org>
+
+ * gmime/gmime-utils.c (rfc2047_encode): Respect the new
+ GMIME_ENABLE_USE_ONLY_USER_CHARSETS initialization flag.
+
+ * gmime/gmime.h: Define a new GMIME_ENABLE_USE_ONLY_USER_CHARSETS
+ initialization flag.
+
2013-04-05 Jeffrey Stedfast <fejj gnome org>
* gmime/gmime-utils.c (header_fold_tokens): New internal function
diff --git a/gmime/gmime-utils.c b/gmime/gmime-utils.c
index c7453e2..534f4c0 100644
--- a/gmime/gmime-utils.c
+++ b/gmime/gmime-utils.c
@@ -78,6 +78,7 @@
**/
extern gboolean _g_mime_enable_rfc2047_workarounds (void);
+extern gboolean _g_mime_use_only_user_charsets (void);
#define GMIME_FOLD_PREENCODED (GMIME_FOLD_LEN / 2)
@@ -2613,8 +2614,10 @@ rfc2047_encode (const char *in, gushort safemask)
rfc2047_encode_word (out, start, len, "us-ascii", safemask);
break;
case 1: /* iso-8859-1 */
- rfc2047_encode_word (out, start, len, "iso-8859-1", safemask);
- break;
+ if (!_g_mime_use_only_user_charsets ()) {
+ rfc2047_encode_word (out, start, len, "iso-8859-1", safemask);
+ break;
+ }
default:
charset = NULL;
g_mime_charset_init (&mask);
diff --git a/gmime/gmime.c b/gmime/gmime.c
index bc87304..230c5a1 100644
--- a/gmime/gmime.c
+++ b/gmime/gmime.c
@@ -47,6 +47,7 @@
**/
extern gboolean _g_mime_enable_rfc2047_workarounds (void);
+extern gboolean _g_mime_use_only_user_charsets (void);
GQuark gmime_gpgme_error_quark;
GQuark gmime_error_quark;
@@ -209,3 +210,9 @@ _g_mime_enable_rfc2047_workarounds (void)
{
return (enable & GMIME_ENABLE_RFC2047_WORKAROUNDS);
}
+
+gboolean
+_g_mime_use_only_user_charsets (void)
+{
+ return (enable & GMIME_ENABLE_USE_ONLY_USER_CHARSETS);
+}
diff --git a/gmime/gmime.h b/gmime/gmime.h
index 6b97b6e..e477292 100644
--- a/gmime/gmime.h
+++ b/gmime/gmime.h
@@ -121,7 +121,16 @@ gboolean g_mime_check_version (guint major, guint minor, guint micro);
* Initialization flag to enable workarounds for badly formed rfc2047
* encoded-words.
**/
-#define GMIME_ENABLE_RFC2047_WORKAROUNDS (1 << 0)
+#define GMIME_ENABLE_RFC2047_WORKAROUNDS (1 << 0)
+
+/**
+ * GMIME_ENABLE_USE_ONLY_USER_CHARSETS:
+ *
+ * Initialization flag that hints to the rfc2047 encoder to use only
+ * the configured user-charsets (set via g_mime_set_user_charsets())
+ * instead of trying to first use iso-8859-1.
+ **/
+#define GMIME_ENABLE_USE_ONLY_USER_CHARSETS (1 << 1)
void g_mime_init (guint32 flags);
void g_mime_shutdown (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]