comparison libpurple/protocols/msn/contact.c @ 28318:534ff54568eb

Don't attempt to change the alias on the server if the contact is not (yet) on it. Fixes #9242 and #10393.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 03 Oct 2009 21:01:57 +0000
parents 97856e3452d0
children 203839bc0f7c
comparison
equal deleted inserted replaced
28317:97856e3452d0 28318:534ff54568eb
1415 { 1415 {
1416 MsnCallbackState *state; 1416 MsnCallbackState *state;
1417 xmlnode *contact; 1417 xmlnode *contact;
1418 xmlnode *contact_info; 1418 xmlnode *contact_info;
1419 xmlnode *changes; 1419 xmlnode *changes;
1420 MsnUser *user = NULL;
1420 1421
1421 purple_debug_info("msn", "Update contact information for %s with new %s: %s\n", 1422 purple_debug_info("msn", "Update contact information for %s with new %s: %s\n",
1422 passport ? passport : "(null)", 1423 passport ? passport : "(null)",
1423 type == MSN_UPDATE_DISPLAY ? "display name" : "alias", 1424 type == MSN_UPDATE_DISPLAY ? "display name" : "alias",
1424 value ? value : "(null)"); 1425 value ? value : "(null)");
1425 g_return_if_fail(passport != NULL); 1426 g_return_if_fail(passport != NULL);
1427
1428 if (strcmp(passport, "Me") != 0) {
1429 user = msn_userlist_find_user(session->userlist, passport);
1430 if (!user)
1431 return;
1432 }
1426 1433
1427 contact_info = xmlnode_new("contactInfo"); 1434 contact_info = xmlnode_new("contactInfo");
1428 changes = xmlnode_new("propertiesChanged"); 1435 changes = xmlnode_new("propertiesChanged");
1429 1436
1430 switch (type) { 1437 switch (type) {
1462 1469
1463 contact = xmlnode_get_child(state->body, "Body/ABContactUpdate/contacts/Contact"); 1470 contact = xmlnode_get_child(state->body, "Body/ABContactUpdate/contacts/Contact");
1464 xmlnode_insert_child(contact, contact_info); 1471 xmlnode_insert_child(contact, contact_info);
1465 xmlnode_insert_child(contact, changes); 1472 xmlnode_insert_child(contact, changes);
1466 1473
1467 if (!strcmp(passport, "Me")) { 1474 if (user) {
1468 xmlnode *contactType = xmlnode_new_child(contact_info, "contactType");
1469 xmlnode_insert_data(contactType, "Me", -1);
1470 } else {
1471 MsnUser *user = msn_userlist_find_user(session->userlist, passport);
1472 xmlnode *contactId = xmlnode_new_child(contact, "contactId"); 1475 xmlnode *contactId = xmlnode_new_child(contact, "contactId");
1473 msn_callback_state_set_uid(state, user->uid); 1476 msn_callback_state_set_uid(state, user->uid);
1474 xmlnode_insert_data(contactId, state->uid, -1); 1477 xmlnode_insert_data(contactId, state->uid, -1);
1478 } else {
1479 xmlnode *contactType = xmlnode_new_child(contact_info, "contactType");
1480 xmlnode_insert_data(contactType, "Me", -1);
1475 } 1481 }
1476 1482
1477 msn_contact_request(state); 1483 msn_contact_request(state);
1478 } 1484 }
1479 1485