pidgin: 9602b152: Disconnect other endpoints if the MPOP s...

qulogic at pidgin.im qulogic at pidgin.im
Thu Dec 2 01:35:50 EST 2010


----------------------------------------------------------------------
Revision: 9602b15266c4fc5b8d091851704e16a0120c9f7a
Parent:   598a42cee11b05ea3af9bc9cdcb5c3e297c3d755
Author:   qulogic at pidgin.im
Date:     12/02/10 01:32:55
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/9602b15266c4fc5b8d091851704e16a0120c9f7a

Changelog: 

Disconnect other endpoints if the MPOP setting is disabled.

Refs #13017.

Changes against parent 598a42cee11b05ea3af9bc9cdcb5c3e297c3d755

  patched  libpurple/protocols/msn/notification.c

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/notification.c	692267ce554d0d283c69883b3196b3e1021eb18b
+++ libpurple/protocols/msn/notification.c	abc1471b0dddbc60628b5aa49b23a13f2a96f9a8
@@ -1551,13 +1551,18 @@ parse_user_endpoints(MsnUser *user, xmln
 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 @@ parse_user_endpoints(MsnUser *user, xmln
 		id = xmlnode_get_attrib(epNode, "id");
 		capsNode = xmlnode_get_child(epNode, "Capabilities");
 
-		if (capsNode != NULL) {
-			caps = xmlnode_get_data(capsNode);
+		/* 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);
 
-			data.clientid = strtoul(caps, &tmp, 10);
-			if (tmp && *tmp)
-				data.extcaps = strtoul(tmp + 1, NULL, 10);
-			else
-				data.extcaps = 0;
+			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);
 
-			g_free(caps);
+				data.clientid = strtoul(caps, &tmp, 10);
+				if (tmp && *tmp)
+					data.extcaps = strtoul(tmp + 1, NULL, 10);
+				else
+					data.extcaps = 0;
 
-		} 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)) {


More information about the Commits mailing list