gmime r1396 - in trunk: . gmime tests



Author: fejj
Date: Sat Aug 16 01:33:37 2008
New Revision: 1396
URL: http://svn.gnome.org/viewvc/gmime?rev=1396&view=rev

Log:
2008-08-15  Jeffrey Stedfast  <fejj novell com>

	* gmime/internet-address.c (decode_mailbox): Implemented a
	work-around for broken email addresses that have more than a
	single '.' between word tokens making up the local-part of an
	addr-spec. See Evolution bug #547969 for details.



Modified:
   trunk/ChangeLog
   trunk/gmime/internet-address.c
   trunk/tests/test-mime.c

Modified: trunk/gmime/internet-address.c
==============================================================================
--- trunk/gmime/internet-address.c	(original)
+++ trunk/gmime/internet-address.c	Sat Aug 16 01:33:37 2008
@@ -23,6 +23,7 @@
 #include <config.h>
 #endif
 
+#include <stdio.h>
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
@@ -843,12 +844,19 @@
 	/* get the rest of the local-part */
 	decode_lwsp (&inptr);
 	while (*inptr == '.' && word) {
-		inptr++;
-		
-		if ((word = decode_word (&inptr))) {
+		/* Note: According to the spec, only a single '.' is
+		 * allowed between word tokens in the local-part of an
+		 * addr-spec token, but according to Evolution bug
+		 * #547969, some Japanese cellphones have email
+		 * addresses that look like x  y somewhere jp */
+		do {
+			inptr++;
+			decode_lwsp (&inptr);
 			g_string_append_c (addr, '.');
+		} while (*inptr == '.');
+		
+		if ((word = decode_word (&inptr)))
 			g_string_append_len (addr, word, inptr - word);
-		}
 		
 		decode_lwsp (&inptr);
 	}

Modified: trunk/tests/test-mime.c
==============================================================================
--- trunk/tests/test-mime.c	(original)
+++ trunk/tests/test-mime.c	Sat Aug 16 01:33:37 2008
@@ -150,6 +150,15 @@
 	{ "undisclosed-recipients",
 	  "undisclosed-recipients",
 	  "undisclosed-recipients" },
+	/* The following 2 addr-specs are invalid according to the
+	 * spec, but apparently some japanese cellphones use them?
+	 * See Evolution bug #547969 */
+	{ "some   dots hocus pocus net",
+	  "some   dots hocus pocus net",
+	  "some   dots hocus pocus net" },
+	{ "some dots   hocus pocus net",
+	  "some dots   hocus pocus net",
+	  "some dots   hocus pocus net" },
 };
 
 static void



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