diff libpurple/protocols/msn/msn.c @ 27558:8accf7a2264c

The MSN client and server strips leading and trailing whitespace, so do the same locally before setting it, so that people don't think that their name actually included any. Also, there's no need to call strlen() to check that the length > 0. Fixes #9447 in a way.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 12 Jul 2009 05:06:45 +0000
parents d375ef85519f
children 3698c7f4d803
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Sun Jul 12 04:41:10 2009 +0000
+++ b/libpurple/protocols/msn/msn.c	Sun Jul 12 05:06:45 2009 +0000
@@ -178,8 +178,12 @@
 	cmdproc = session->notification->cmdproc;
 	account = purple_connection_get_account(gc);
 
-	if(entry && strlen(entry))
-		alias = purple_url_encode(entry);
+	if (entry && *entry)
+	{
+		char *tmp = g_strdup(entry);
+		alias = purple_url_encode(g_strstrip(tmp));
+		g_free(tmp);
+	}
 	else
 		alias = "";
 
@@ -195,7 +199,6 @@
 	}
 
 	msn_cmdproc_send(cmdproc, "PRP", "MFN %s", alias);
-
 }
 
 static void