CVS: sylpheed-claws/src/common utils.c,1.36.2.60,1.36.2.60.2.1

Colin Leroy <[email protected]>
Newsgroups gmane.mail.sylpheed.claws.cvs
Message-ID <[email protected]>
Update of /cvsroot/sylpheed-claws/sylpheed-claws/src/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9772/src/common

Modified Files:
      Tag: stable_2_1
	utils.c 
Log Message:
2006-04-21 [colin]	2.1.1cvs6-stable

	* src/folderview.c
	* src/mainwindow.c
	* src/common/utils.c
		From 2.1.1cvs21
		Fix bug #943 (Incorrectly parsed email address 
		list in short headers on message view and in 
		printouts), and fix occasional folder flicker

Index: utils.c
===================================================================
RCS file: /cvsroot/sylpheed-claws/sylpheed-claws/src/common/utils.c,v
retrieving revision 1.36.2.60
retrieving revision 1.36.2.60.2.1
diff -u -r1.36.2.60 -r1.36.2.60.2.1
--- utils.c	23 Mar 2006 13:12:16 -0000	1.36.2.60
+++ utils.c	21 Apr 2006 16:54:42 -0000	1.36.2.60.2.1
@@ -4377,6 +4377,8 @@
 	g_return_val_if_fail(ep != NULL, FALSE);
 
 	if (hdr) {
+		const gchar *start_quote = NULL;
+		const gchar *end_quote = NULL;
 search_again:
 		/* go to the real start */
 		if (start[0] == ',')
@@ -4387,6 +4389,22 @@
 			start++;
 
 		*bp = start;
+		
+		/* check if there are quotes (to skip , in them) */
+		if (*start == '"') {
+			start_quote = start;
+			start++;
+			end_quote = strstr(start, "\"");
+		} else {
+			start_quote = NULL;
+			end_quote = NULL;
+		}
+		
+		/* skip anything between quotes */
+		if (start_quote && end_quote) {
+			start = end_quote;
+			
+		} 
 
 		/* find end (either , or ; or end of line) */
 		if (strstr(start, ",") && strstr(start, ";"))
@@ -4399,6 +4417,11 @@
 		else
 			*ep = start+strlen(start);
 
+		/* go back to real start */
+		if (start_quote && end_quote) {
+			start = start_quote;
+		}
+
 		/* check there's still an @ in that, or search
 		 * further if possible */
 		if (strstr(start, "@") && strstr(start, "@") < *ep)
@@ -4406,6 +4429,9 @@
 		else if (*ep < start+strlen(start)) {
 			start = *ep;
 			goto search_again;
+		} else if (start_quote && strstr(start, "\"") && strstr(start, "\"") < *ep) {
+			*bp = start_quote;
+			return TRUE;
 		} else
 			return FALSE;
 	}



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.