[evolution-patches] patch to revert the fix for bug #42170 (fixes bug #46331)



I think a better approach to bug #42170 might be to check the parsed
addr->str when we're done and do charset conversions there instead? or
maybe just replace those invalid 8bit chars with a '?' or something?
it's 100% invalid... those can't be real email addresses, so no sense
trying to "make it work".

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
? 46331.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1836.2.5
diff -u -r1.1836.2.5 ChangeLog
--- ChangeLog	17 Jul 2003 06:22:25 -0000	1.1836.2.5
+++ ChangeLog	24 Jul 2003 20:56:40 -0000
@@ -1,3 +1,11 @@
+2003-07-24  Jeffrey Stedfast  <fejj ximian com>
+
+	* camel-mime-utils.c (header_decode_word): Revert NotZed's fix for
+	bug #42170 - this causes even more problems than it solves. See
+	bug #46331 for info. Basically, each address header would be
+	converted to UTF-8 twice which means no raw 8bit address header
+	would render correctly.
+
 2003-07-17  Timo Sirainen <tss iki fi>
 
 	** See bug #42573
Index: camel-mime-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-mime-utils.c,v
retrieving revision 1.183.4.2
diff -u -r1.183.4.2 camel-mime-utils.c
--- camel-mime-utils.c	2 Jul 2003 16:46:33 -0000	1.183.4.2
+++ camel-mime-utils.c	24 Jul 2003 20:56:45 -0000
@@ -1777,36 +1777,18 @@
 }
 
 static char *
-header_decode_word(const char **in, const char *charset)
+header_decode_word(const char **in)
 {
-	char *out;
+	const char *inptr = *in;
 
-	header_decode_lwsp(in);
-	if (**in == '"')
-		out = header_decode_quoted_string(in);
-	else
-		out = header_decode_atom(in);
-
-	/* FIXME: temporary workaround for non-ascii-data problem, see bug #42710 */
-	if (out) {
-		char *p;
-
-		for (p=out;*p;p++) {
-			if ((*p) & 0x80) {
-				GString *newstr = g_string_new("");
-
-				if (charset == NULL || !append_8bit(newstr, out, strlen(out), charset))
-					append_latin1(newstr, out, strlen(out));
-
-				g_free(out);
-				out = newstr->str;
-				g_string_free(newstr, FALSE);
-				break;
-			}
-		}
+	header_decode_lwsp(&inptr);
+	if (*inptr == '"') {
+		*in = inptr;
+		return header_decode_quoted_string(in);
+	} else {
+		*in = inptr;
+		return header_decode_atom(in);
 	}
-
-	return out;
 }
 
 static char *
@@ -2300,7 +2282,7 @@
 	header_decode_lwsp(&inptr);
 
 	/* addr-spec */
-	word = header_decode_word(&inptr, NULL);
+	word = header_decode_word(&inptr);
 	if (word) {
 		addr = g_string_append(addr, word);
 		header_decode_lwsp(&inptr);
@@ -2308,7 +2290,7 @@
 		while (*inptr == '.' && word) {
 			inptr++;
 			addr = g_string_append_c(addr, '.');
-			word = header_decode_word(&inptr, NULL);
+			word = header_decode_word(&inptr);
 			if (word) {
 				addr = g_string_append(addr, word);
 				header_decode_lwsp(&inptr);
@@ -2369,7 +2351,7 @@
 	addr = g_string_new("");
 
 	/* for each address */
-	pre = header_decode_word(&inptr, charset);
+	pre = header_decode_word(&inptr);
 	header_decode_lwsp(&inptr);
 	if (!(*inptr == '.' || *inptr == '@' || *inptr==',' || *inptr=='\0')) {
 		/* ',' and '\0' required incase it is a simple address, no @ domain part (buggy writer) */
@@ -2383,7 +2365,7 @@
 			last = pre;
 			g_free(text);
 
-			pre = header_decode_word(&inptr, charset);
+			pre = header_decode_word(&inptr);
 			if (pre) {
 				size_t l = strlen (last);
 				size_t p = strlen (pre);
@@ -2401,7 +2383,7 @@
 				while (!pre && *inptr && *inptr != '<') {
 					w(g_warning("Working around stupid mailer bug #5: unescaped characters in names"));
 					name = g_string_append_c(name, *inptr++);
-					pre = header_decode_word(&inptr, charset);
+					pre = header_decode_word(&inptr);
 				}
 			}
 			g_free(last);
@@ -2428,7 +2410,7 @@
 					w(g_warning("broken route-address, missing ':': %s", *in));
 				}
 			}
-			pre = header_decode_word(&inptr, charset);
+			pre = header_decode_word(&inptr);
 			header_decode_lwsp(&inptr);
 		} else {
 			w(g_warning("broken address? %s", *in));
@@ -2445,7 +2427,7 @@
 	while (*inptr == '.' && pre) {
 		inptr++;
 		g_free(pre);
-		pre = header_decode_word(&inptr, charset);
+		pre = header_decode_word(&inptr);
 		addr = g_string_append_c(addr, '.');
 		if (pre)
 			addr = g_string_append(addr, pre);
@@ -2568,7 +2550,7 @@
 
 	/* pre-scan, trying to work out format, discard results */
 	header_decode_lwsp(&inptr);
-	while ( (pre = header_decode_word(&inptr, charset)) ) {
+	while ( (pre = header_decode_word(&inptr)) ) {
 		group = g_string_append(group, pre);
 		group = g_string_append(group, " ");
 		g_free(pre);
@@ -2683,7 +2665,7 @@
 	}
 	
 	/* Eudora has been known to use <.@> as a content-id */
-	if (!(buf = header_decode_word (&inptr, NULL)) && !strchr (".@", *inptr))
+	if (!(buf = header_decode_word (&inptr)) && !strchr (".@", *inptr))
 		return NULL;
 	
 	addr = g_string_new ("");
@@ -2698,10 +2680,10 @@
 		if (!at) {
 			if (*inptr == '.') {
 				g_string_append_c (addr, *inptr++);
-				buf = header_decode_word (&inptr, NULL);
+				buf = header_decode_word (&inptr);
 			} else if (*inptr == '@') {
 				g_string_append_c (addr, *inptr++);
-				buf = header_decode_word (&inptr, NULL);
+				buf = header_decode_word (&inptr);
 				at = TRUE;
 			}
 		} else if (strchr (".[]", *inptr)) {
@@ -2774,7 +2756,7 @@
 				break;
 			}
 		} else {
-			word = header_decode_word (&inptr, NULL);
+			word = header_decode_word (&inptr);
 			if (word)
 				g_free (word);
 			else if (*inptr != '\0')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]