[gmime] Make sure to mark rfc2047 tokens as 8bit when appropriate
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Make sure to mark rfc2047 tokens as 8bit when appropriate
- Date: Thu, 22 Dec 2011 00:43:55 +0000 (UTC)
commit adc2f3afd4bb8c701f335d5250254bc301243297
Author: Jeffrey Stedfast <fejj gnome org>
Date: Wed Dec 21 19:43:18 2011 -0500
Make sure to mark rfc2047 tokens as 8bit when appropriate
gmime/gmime-utils.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/gmime/gmime-utils.c b/gmime/gmime-utils.c
index 7c06e2a..2d83356 100644
--- a/gmime/gmime-utils.c
+++ b/gmime/gmime-utils.c
@@ -1949,8 +1949,10 @@ tokenize_rfc2047_phrase (const char *in, size_t *len)
inptr += 2;
/* skip past the charset (if one is even declared, sigh) */
- while (*inptr && *inptr != '?')
+ while (*inptr && *inptr != '?') {
+ ascii = ascii && is_ascii (*inptr);
inptr++;
+ }
/* sanity check encoding type */
if (inptr[0] != '?' || !strchr ("BbQq", inptr[1]) || inptr[2] != '?')
@@ -1959,12 +1961,16 @@ tokenize_rfc2047_phrase (const char *in, size_t *len)
inptr += 3;
/* find the end of the rfc2047 encoded word token */
- while (*inptr && strncmp (inptr, "?=", 2) != 0)
+ while (*inptr && strncmp (inptr, "?=", 2) != 0) {
+ ascii = ascii && is_ascii (*inptr);
inptr++;
+ }
if (*inptr == '\0') {
/* didn't find an end marker... */
inptr = word + 2;
+ ascii = TRUE;
+
goto non_rfc2047;
}
@@ -2004,6 +2010,7 @@ tokenize_rfc2047_phrase (const char *in, size_t *len)
}
token = rfc2047_token_new (word, n);
+ token->is_8bit = ascii ? 0 : 1;
tail->next = token;
tail = token;
@@ -2024,10 +2031,7 @@ tokenize_rfc2047_phrase (const char *in, size_t *len)
n = (size_t) (inptr - word);
token = rfc2047_token_new (word, n);
- if (!ascii) {
- /* *sigh* I hate broken mailers... */
- token->is_8bit = 1;
- }
+ token->is_8bit = ascii ? 0 : 1;
tail->next = token;
tail = token;
@@ -2141,6 +2145,7 @@ tokenize_rfc2047_text (const char *in, size_t *len)
}
token = rfc2047_token_new (word, n);
+ token->is_8bit = ascii ? 0 : 1;
tail->next = token;
tail = token;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]