Don't attempt to change the alias on the server if the contact is not (yet)

Sat, 03 Oct 2009 21:01:57 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sat, 03 Oct 2009 21:01:57 +0000
changeset 28614
1746321a8c5b
parent 28613
a91c90f8d63a
child 28615
0759267334b3

Don't attempt to change the alias on the server if the contact is not (yet)
on it.

Fixes #9242 and #10393.

libpurple/protocols/msn/contact.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/msn/contact.c	Sat Oct 03 20:01:35 2009 +0000
+++ b/libpurple/protocols/msn/contact.c	Sat Oct 03 21:01:57 2009 +0000
@@ -1417,6 +1417,7 @@
 	xmlnode *contact;
 	xmlnode *contact_info;
 	xmlnode *changes;
+	MsnUser *user = NULL;
 
 	purple_debug_info("msn", "Update contact information for %s with new %s: %s\n",
 		passport ? passport : "(null)",
@@ -1424,6 +1425,12 @@
 		value ? value : "(null)");
 	g_return_if_fail(passport != NULL);
 
+	if (strcmp(passport, "Me") != 0) {
+		user = msn_userlist_find_user(session->userlist, passport);
+		if (!user)
+			return;
+	}
+
 	contact_info = xmlnode_new("contactInfo");
 	changes = xmlnode_new("propertiesChanged");
 
@@ -1464,14 +1471,13 @@
 	xmlnode_insert_child(contact, contact_info);
 	xmlnode_insert_child(contact, changes);
 
-	if (!strcmp(passport, "Me")) {
-		xmlnode *contactType = xmlnode_new_child(contact_info, "contactType");
-		xmlnode_insert_data(contactType, "Me", -1);
-	} else {
-		MsnUser *user = msn_userlist_find_user(session->userlist, passport);
+	if (user) {
 		xmlnode *contactId = xmlnode_new_child(contact, "contactId");
 		msn_callback_state_set_uid(state, user->uid);
 		xmlnode_insert_data(contactId, state->uid, -1);
+	} else {
+		xmlnode *contactType = xmlnode_new_child(contact_info, "contactType");
+		xmlnode_insert_data(contactType, "Me", -1);
 	}
 
 	msn_contact_request(state);

mercurial