changeset 21685:b08d0296ab88

Fix 2 more issues related to friendly names: - Don't try setting any friendly names for unverified passports - Don't try setting a friendly name if they are not actually on our friend list Fixes #4109
author Stu Tomlinson <stu@nosnilmot.com>
date Wed, 28 Nov 2007 19:14:26 +0000
parents c6487d5385f9
children 280f622cb9b0
files libpurple/protocols/msnp9/notification.c libpurple/protocols/msnp9/session.h libpurple/protocols/msnp9/user.c
diffstat 3 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msnp9/notification.c	Wed Nov 28 14:00:50 2007 +0000
+++ b/libpurple/protocols/msnp9/notification.c	Wed Nov 28 19:14:26 2007 +0000
@@ -235,6 +235,8 @@
 		/* OK */
 		const char *friendly = purple_url_decode(cmd->params[3]);
 
+		session->passport_info.verified = atoi(cmd->params[4]);
+
 		purple_connection_set_display_name(gc, friendly);
 
 		msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN);
--- a/libpurple/protocols/msnp9/session.h	Wed Nov 28 14:00:50 2007 +0000
+++ b/libpurple/protocols/msnp9/session.h	Wed Nov 28 19:14:26 2007 +0000
@@ -114,7 +114,7 @@
 		char *file;
 		char *client_ip;
 		int client_port;
-
+		int verified;
 	} passport_info;
 };
 
--- a/libpurple/protocols/msnp9/user.c	Wed Nov 28 14:00:50 2007 +0000
+++ b/libpurple/protocols/msnp9/user.c	Wed Nov 28 19:14:26 2007 +0000
@@ -126,16 +126,20 @@
 msn_user_set_friendly_name(MsnUser *user, const char *name)
 {
 	MsnCmdProc *cmdproc;
+	MsnSession *session;
 	const char *encoded;
 
 	g_return_if_fail(user != NULL);
 
 	encoded = purple_url_encode(name);
+	session = user->userlist->session;
 
-	if (user->friendly_name && strcmp(user->friendly_name, name) && (strlen(encoded) < 387)) {
+	if (user->friendly_name && strcmp(user->friendly_name, name)
+		&& (strlen(encoded) < 387) && session->passport_info.verified &&
+		(user->list_op & MSN_LIST_FL_OP)) {
 		/* copy the new name to the server list, but only when new */
 		/* should we check this more thoroughly? */
-		cmdproc = user->userlist->session->notification->cmdproc;
+		cmdproc = session->notification->cmdproc;
 		msn_cmdproc_send(cmdproc, "REA", "%s %s",
 						 user->passport,
 						 encoded);