changeset 32488:760fd1f86a54

Send circle authentication on the notification server on MSNP18.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 03 Feb 2012 06:04:05 +0000
parents ab9025b46134
children 9af8ed674a69
files libpurple/protocols/msn/contact.c libpurple/protocols/msn/notification.c libpurple/protocols/msn/notification.h
diffstat 3 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Fri Feb 03 04:57:18 2012 +0000
+++ b/libpurple/protocols/msn/contact.c	Fri Feb 03 06:04:05 2012 +0000
@@ -871,6 +871,7 @@
 	xmlnode *groups;
 	xmlnode *contacts;
 	xmlnode *abNode;
+	xmlnode *circleNode;
 	xmlnode *fault;
 
 	if ((fault = xmlnode_get_child(node, "Body/Fault"))) {
@@ -954,6 +955,15 @@
 		g_free(tmp);
 	}
 
+	circleNode = xmlnode_get_child(result, "CircleResult/CircleTicket");
+	if (circleNode != NULL && session->protocol_ver >= 18) {
+		char *data;
+
+		data = xmlnode_get_data(circleNode);
+		msn_notification_send_circle_auth(session, data);
+		g_free(data);
+	}
+
 	return TRUE;
 }
 
--- a/libpurple/protocols/msn/notification.c	Fri Feb 03 04:57:18 2012 +0000
+++ b/libpurple/protocols/msn/notification.c	Fri Feb 03 06:04:05 2012 +0000
@@ -1964,6 +1964,22 @@
 	msn_cmdproc_send_trans(cmdproc, trans);
 }
 
+void
+msn_notification_send_circle_auth(MsnSession *session, const char *ticket)
+{
+	MsnTransaction *trans;
+	MsnCmdProc *cmdproc;
+	char *encoded;
+
+	cmdproc = session->notification->cmdproc;
+
+	encoded = purple_base64_encode((guchar *)ticket, strlen(ticket));
+	trans = msn_transaction_new(cmdproc, "USR", "SHA A %s", encoded);
+	msn_cmdproc_send_trans(cmdproc, trans);
+
+	g_free(encoded);
+}
+
 /**************************************************************************
  * Message Types
  **************************************************************************/
--- a/libpurple/protocols/msn/notification.h	Fri Feb 03 04:57:18 2012 +0000
+++ b/libpurple/protocols/msn/notification.h	Fri Feb 03 06:04:05 2012 +0000
@@ -108,6 +108,8 @@
                                MsnUnifiedNotificationType type,
                                const char *payload);
 
+void msn_notification_send_circle_auth(MsnSession *session, const char *ticket);
+
 /**
  * Closes a notification.
  *