changeset 30682:f56126c5aa44

Save PrivateEndpointData that we've received. I think this only applies to ourselves, so only check if it's our own UBX. This currently only makes use of the endpoint name and type.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 15 Dec 2009 02:05:32 +0000
parents fee2d38d14bd
children 509c4ffff958
files libpurple/protocols/msn/notification.c libpurple/protocols/msn/user.c libpurple/protocols/msn/user.h
diffstat 3 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c	Tue Dec 15 01:42:24 2009 +0000
+++ b/libpurple/protocols/msn/notification.c	Tue Dec 15 02:05:32 2009 +0000
@@ -1671,6 +1671,41 @@
 
 		msn_user_set_endpoint_data(user, id, &data);
 	}
+
+	/* Need to shortcut this check, probably... */
+	if (user == user->userlist->session->user) {
+		for (epNode = xmlnode_get_child(payloadNode, "PrivateEndpointData");
+		     epNode;
+		     epNode = xmlnode_get_next_twin(epNode)) {
+			MsnUserEndpoint *ep;
+			xmlnode *nameNode, *clientNode;
+
+			/*	<PrivateEndpointData id='{GUID}'>
+					<EpName>Endpoint Name</EpName>
+					<Idle>true/false</Idle>
+					<ClientType>1</ClientType>
+					<State>NLN</State>
+				</PrivateEndpointData>
+			*/
+			id = xmlnode_get_attrib(epNode, "id");
+			ep = msn_user_get_endpoint_data(user, id);
+
+			if (ep != NULL) {
+				nameNode = xmlnode_get_child(epNode, "EpName");
+				if (nameNode != NULL) {
+					g_free(ep->name);
+					ep->name = xmlnode_get_data(nameNode);
+				}
+
+				clientNode = xmlnode_get_child(epNode, "ClientType");
+				if (clientNode != NULL) {
+					tmp = xmlnode_get_data(clientNode);
+					ep->type = strtoul(tmp, 10, NULL);
+					g_free(tmp);
+				}
+			}
+		}
+	}
 }
 
 /*
--- a/libpurple/protocols/msn/user.c	Tue Dec 15 01:42:24 2009 +0000
+++ b/libpurple/protocols/msn/user.c	Tue Dec 15 02:05:32 2009 +0000
@@ -243,6 +243,7 @@
 free_user_endpoint(MsnUserEndpoint *data)
 {
 	g_free(data->id);
+	g_free(data->name);
 	g_free(data);
 }
 
--- a/libpurple/protocols/msn/user.h	Tue Dec 15 01:42:24 2009 +0000
+++ b/libpurple/protocols/msn/user.h	Tue Dec 15 02:05:32 2009 +0000
@@ -116,6 +116,8 @@
  */
 typedef struct MsnUserEndpoint {
 	char *id;				/**< The client's endpoint ID          */
+	char *name;				/**< The client's endpoint's name      */
+	int type;				/**< The client's endpoint type        */
 	guint clientid;         /**< The client's ID                   */
 	guint extcaps;			/**< The client's extended capabilites */