changeset 16791:2ff9195a35ce

merge of '5f4a03fa07b74453c3b8312c388af42739fd16db' and '7ca58433ae1536292fa1729bd1b5f8b0ab0b4c01'
author Richard Laager <rlaager@wiktel.com>
date Wed, 02 May 2007 14:27:45 +0000
parents e3f4f1fd8f3d (diff) db38488fd2ff (current diff)
children d0f9b2b217cf
files
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/bonjour.c	Wed May 02 14:17:40 2007 +0000
+++ b/libpurple/protocols/bonjour/bonjour.c	Wed May 02 14:27:45 2007 +0000
@@ -460,6 +460,7 @@
 	const char *fullname = NULL;
 #endif
 	char *splitpoint = NULL;
+	char *tmp;
 	char hostname[255];
 
 #ifndef _WIN32
@@ -545,7 +546,16 @@
 	if (splitpoint != NULL)
 	{
 		default_firstname = g_strndup(fullname, splitpoint - fullname);
-		default_lastname = g_strdup(&splitpoint[1]);
+		tmp = &splitpoint[1];
+		
+		/* The last name may be followed by a comma and additional data.
+		 * Only use the last name itself.
+		 */
+		splitpoint = strchr(tmp, ',');
+		if (splitpoint != NULL)
+			default_lastname = g_strndup(tmp, splitpoint - tmp);			
+		else
+			default_lastname = g_strdup(tmp);
 	}
 	else
 	{