changeset 21674:4bc7d44f543a

Prevent exceeding the server limit on friendly name length when setting buddies friendly names on the server. This should fix at least some (if not all) of the new "Can't connect to MSN OMGWTFBBQ!" problems reported for 2.3.0
author Stu Tomlinson <stu@nosnilmot.com>
date Wed, 28 Nov 2007 01:31:36 +0000
parents f9738214f308
children ebe79cae6d83
files libpurple/protocols/msnp9/user.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msnp9/user.c	Wed Nov 28 01:30:35 2007 +0000
+++ b/libpurple/protocols/msnp9/user.c	Wed Nov 28 01:31:36 2007 +0000
@@ -126,16 +126,19 @@
 msn_user_set_friendly_name(MsnUser *user, const char *name)
 {
 	MsnCmdProc *cmdproc;
+	const char *encoded;
 
 	g_return_if_fail(user != NULL);
 
-	if (user->friendly_name && strcmp(user->friendly_name, name)) {
+	encoded = purple_url_encode(name);
+
+	if (user->friendly_name && strcmp(user->friendly_name, name) && (strlen(encoded) < 387)) {
 		/* copy the new name to the server list, but only when new */
 		/* should we check this more thoroughly? */
 		cmdproc = user->userlist->session->notification->cmdproc;
 		msn_cmdproc_send(cmdproc, "REA", "%s %s",
 						 user->passport,
-						 purple_url_encode(name));
+						 encoded);
 	}
 
 	g_free(user->friendly_name);