# HG changeset patch # User Elliott Sales de Andrade # Date 1291271575 0 # Node ID 1546ad4f93b3936bb078d92f81dd18b34a813ec1 # Parent 05b3fa3725a10634470e88f320a35eec92647380 Disconnect other endpoints if the MPOP setting is disabled. Refs #13017. diff -r 05b3fa3725a1 -r 1546ad4f93b3 libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Thu Dec 02 06:14:19 2010 +0000 +++ b/libpurple/protocols/msn/notification.c Thu Dec 02 06:32:55 2010 +0000 @@ -1551,13 +1551,18 @@ static void parse_user_endpoints(MsnUser *user, xmlnode *payloadNode) { + MsnSession *session; xmlnode *epNode, *capsNode; MsnUserEndpoint data; const char *id; char *caps, *tmp; + gboolean is_me; purple_debug_info("msn", "Get EndpointData\n"); + session = user->userlist->session; + is_me = (user == session->user); + msn_user_clear_endpoints(user); for (epNode = xmlnode_get_child(payloadNode, "EndpointData"); epNode; @@ -1565,27 +1570,36 @@ id = xmlnode_get_attrib(epNode, "id"); capsNode = xmlnode_get_child(epNode, "Capabilities"); - if (capsNode != NULL) { - caps = xmlnode_get_data(capsNode); - - data.clientid = strtoul(caps, &tmp, 10); - if (tmp && *tmp) - data.extcaps = strtoul(tmp + 1, NULL, 10); - else + /* Disconnect others, if MPOP is disabled */ + if (is_me + && !purple_account_get_bool(session->account, "mpop", TRUE) + && strncasecmp(id + 1, session->guid, 36) != 0) { + purple_debug_info("msn", "Disconnecting Endpoint %s\n", id); + + tmp = g_strdup_printf("%s;%s", user->passport, id); + msn_notification_send_uun(session, tmp, MSN_UNIFIED_NOTIFICATION_MPOP, "goawyplzthxbye"); + g_free(tmp); + } else { + if (capsNode != NULL) { + caps = xmlnode_get_data(capsNode); + + data.clientid = strtoul(caps, &tmp, 10); + if (tmp && *tmp) + data.extcaps = strtoul(tmp + 1, NULL, 10); + else + data.extcaps = 0; + + g_free(caps); + } else { + data.clientid = 0; data.extcaps = 0; - - g_free(caps); - - } else { - data.clientid = 0; - data.extcaps = 0; + } + + msn_user_set_endpoint_data(user, id, &data); } - - msn_user_set_endpoint_data(user, id, &data); } - /* Need to shortcut this check, probably... */ - if (user == user->userlist->session->user) { + if (is_me && purple_account_get_bool(session->account, "mpop", TRUE)) { for (epNode = xmlnode_get_child(payloadNode, "PrivateEndpointData"); epNode; epNode = xmlnode_get_next_twin(epNode)) {