changeset 32533:e091c8ea292e

Pluck all MSNP18 changes. This is pretty much to fix sending OIMs. *** Plucked rev b8b574c4d6f6c05105b372191ca5259b4ae0ad41 (qulogic@pidgin.im): Add a function for parsing a network:username for MSNP18. *** Plucked rev 86bb401efa33f02ca5d28fea216a39a3cf29b5b4 (qulogic@pidgin.im): Fix UBX on MSNP18. *** Plucked rev ba2513694e6abcbdfddc66820f1df20540a36847 (qulogic@pidgin.im): Fix NLN on MSNP18. *** Plucked rev 83a617670da618f4dbdeeebbdb5e2813a4ad2c0c (qulogic@pidgin.im): Switch to ABFindContactsPaged instead of ABFindAll. *** Plucked rev b6bd214d29db885c6d28628c163fa144bdf4a76d (qulogic@pidgin.im): Send circle authentication on the notification server on MSNP18. *** Plucked rev 2ca50146aa67469313579cea414e4a2b660939aa (qulogic@pidgin.im): Make a small name change. *** Plucked rev 2c13bf358104060d6713317e18e03b434862cb38 (qulogic@pidgin.im): Add a missing function. *** Plucked rev a8deb3f73726f4148e8f36f317a88fedcb051c34 (qulogic@pidgin.im): Update UUM to allow sending to users on any network. *** Plucked rev dddff988e830a7a2fa0e40aad200f0e908b9231e (qulogic@pidgin.im): Switch to MSNP18. *** Plucked rev 9fe45819000c530c509c07b7feb29ce9d4ea13b0 (qulogic@pidgin.im): Send offline messages using UUM. *** Plucked rev c1584182b85f99fa3507ea3f76b07865ee7e43f7 (qulogic@pidgin.im): Drop support for protocols below 18. *** Plucked rev f0388e54998489dbe4b6133796f77459f20fe884 (qulogic@pidgin.im): Fix indices for client capabilities and display pics.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 22 Feb 2012 05:52:30 +0000
parents 2851202488e9
children 9f580e02d1e7
files libpurple/protocols/msn/contact.c libpurple/protocols/msn/contact.h libpurple/protocols/msn/msn.c libpurple/protocols/msn/msn.h libpurple/protocols/msn/msnutils.c libpurple/protocols/msn/msnutils.h libpurple/protocols/msn/notification.c libpurple/protocols/msn/notification.h libpurple/protocols/msn/session.c libpurple/protocols/msn/state.c libpurple/protocols/msn/switchboard.c libpurple/protocols/msn/user.c
diffstat 12 files changed, 204 insertions(+), 155 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/contact.c	Wed Feb 22 05:52:30 2012 +0000
@@ -864,6 +864,21 @@
 	g_free(alias);
 }
 
+static void
+msn_parse_addressbook_circles(MsnSession *session, xmlnode *node)
+{
+	xmlnode *ticket;
+
+	/* TODO: Parse groups */
+
+	ticket = xmlnode_get_child(node, "CircleTicket");
+	if (ticket) {
+		char *data = xmlnode_get_data(ticket);
+		msn_notification_send_circle_auth(session, data);
+		g_free(data);
+	}
+}
+
 static gboolean
 msn_parse_addressbook(MsnSession *session, xmlnode *node)
 {
@@ -871,6 +886,7 @@
 	xmlnode *groups;
 	xmlnode *contacts;
 	xmlnode *abNode;
+	xmlnode *circleNode;
 	xmlnode *fault;
 
 	if ((fault = xmlnode_get_child(node, "Body/Fault"))) {
@@ -897,7 +913,7 @@
 		return FALSE;
 	}
 
-	result = xmlnode_get_child(node, "Body/ABFindAllResponse/ABFindAllResult");
+	result = xmlnode_get_child(node, "Body/ABFindContactsPagedResponse/ABFindContactsPagedResult");
 	if (result == NULL) {
 		purple_debug_misc("msn", "Received no address book update\n");
 		return TRUE;
@@ -906,7 +922,7 @@
 	/* I don't see this "groups" tag documented on msnpiki, need to find out
 	   if they are really there, and update msnpiki */
 	/*Process Group List*/
-	groups = xmlnode_get_child(result, "groups");
+	groups = xmlnode_get_child(result, "Groups");
 	if (groups != NULL) {
 		msn_parse_addressbook_groups(session, groups);
 	}
@@ -931,12 +947,12 @@
 
 	/*Process contact List*/
 	purple_debug_info("msn", "Process contact list...\n");
-	contacts = xmlnode_get_child(result, "contacts");
+	contacts = xmlnode_get_child(result, "Contacts");
 	if (contacts != NULL) {
 		msn_parse_addressbook_contacts(session, contacts);
 	}
 
-	abNode = xmlnode_get_child(result, "ab");
+	abNode = xmlnode_get_child(result, "Ab");
 	if (abNode != NULL) {
 		xmlnode *node2;
 		char *tmp = NULL;
@@ -954,6 +970,11 @@
 		g_free(tmp);
 	}
 
+	circleNode = xmlnode_get_child(result, "CircleResult");
+	if (circleNode != NULL) {
+		msn_parse_addressbook_circles(session, circleNode);
+	}
+
 	return TRUE;
 }
 
--- a/libpurple/protocols/msn/contact.h	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/contact.h	Wed Feb 22 05:52:30 2012 +0000
@@ -142,11 +142,13 @@
 "</soap:Envelope>"
 
 /* Get AddressBook */
-#define MSN_GET_ADDRESS_SOAP_ACTION	"http://www.msn.com/webservices/AddressBook/ABFindAll"
+#define MSN_GET_ADDRESS_SOAP_ACTION	"http://www.msn.com/webservices/AddressBook/ABFindContactsPaged"
 #define MSN_GET_ADDRESS_FULL_TIME	"0001-01-01T00:00:00.0000000-08:00"
 #define MSN_GET_ADDRESS_UPDATE_XML \
-	"<deltasOnly>true</deltasOnly>"\
-	"<lastChange>%s</lastChange>"
+	"<filterOptions>"\
+		"<deltasOnly>true</deltasOnly>"\
+		"<lastChange>%s</lastChange>"\
+	"</filterOptions>"
 
 #define MSN_GET_GLEAM_UPDATE_XML \
 	"%s"\
@@ -171,11 +173,11 @@
 		"</ABAuthHeader>"\
 	"</soap:Header>"\
 	"<soap:Body>"\
-		"<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">"\
-			"<abId>00000000-0000-0000-0000-000000000000</abId>"\
+		"<ABFindContactsPaged xmlns=\"http://www.msn.com/webservices/AddressBook\">"\
 			"<abView>Full</abView>"\
+			"<extendedContent>AB AllGroups CircleResult</extendedContent>"\
 			"%s"\
-		"</ABFindAll>"\
+		"</ABFindContactsPaged>"\
 	"</soap:Body>"\
 "</soap:Envelope>"
 
--- a/libpurple/protocols/msn/msn.c	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/msn.c	Wed Feb 22 05:52:30 2012 +0000
@@ -1220,7 +1220,7 @@
 	m = g_list_append(m, act);
 	m = g_list_append(m, NULL);
 
-	if (session->enable_mpop && session->protocol_ver >= 16)
+	if (session->enable_mpop)
 	{
 		act = purple_plugin_action_new(_("View Locations..."),
 		                               msn_show_locations);
@@ -1567,89 +1567,68 @@
 		return 0;
 	}
 
-	if (msn_user_is_online(account, who) ||
-		msn_user_is_yahoo(account, who) ||
-		swboard != NULL) {
-		/*User online or have a swboard open because it's invisible
-		 * and sent us a message,then send Online Instant Message*/
-
-		if (msglen + strlen(msgformat) + strlen(VERSION) > 1564)
-		{
-			g_free(msgformat);
-			g_free(msgtext);
-
-			return -E2BIG;
-		}
-
-		msg = msn_message_new_plain(msgtext);
-		msg->remote_user = g_strdup(who);
-		msn_message_set_header(msg, "X-MMS-IM-Format", msgformat);
-
+	if (msglen + strlen(msgformat) + strlen(VERSION) > 1564)
+	{
 		g_free(msgformat);
 		g_free(msgtext);
 
-		purple_debug_info("msn", "prepare to send online Message\n");
-		if (g_ascii_strcasecmp(who, username))
-		{
-			if (flags & PURPLE_MESSAGE_AUTO_RESP) {
-				msn_message_set_flag(msg, 'U');
-			}
-			if (msn_user_is_yahoo(account, who)) {
-				/*we send the online and offline Message to Yahoo User via UBM*/
-				purple_debug_info("msn", "send to Yahoo User\n");
-				uum_send_msg(session, msg);
-			} else {
-				purple_debug_info("msn", "send via switchboard\n");
-				msn_send_im_message(session, msg);
-			}
+		return -E2BIG;
+	}
+
+	msg = msn_message_new_plain(msgtext);
+	msg->remote_user = g_strdup(who);
+	msn_message_set_header(msg, "X-MMS-IM-Format", msgformat);
+
+	g_free(msgformat);
+	g_free(msgtext);
+
+	purple_debug_info("msn", "prepare to send online Message\n");
+	if (g_ascii_strcasecmp(who, username))
+	{
+		if (flags & PURPLE_MESSAGE_AUTO_RESP) {
+			msn_message_set_flag(msg, 'U');
+		}
+
+		if (msn_user_is_yahoo(account, who) || !(msn_user_is_online(account, who) || swboard != NULL)) {
+			/*we send the online and offline Message to Yahoo User via UBM*/
+			purple_debug_info("msn", "send to Yahoo User\n");
+			msn_notification_send_uum(session, msg);
+		} else {
+			purple_debug_info("msn", "send via switchboard\n");
+			msn_send_im_message(session, msg);
 		}
-		else
-		{
-			char *body_str, *body_enc, *pre, *post;
-			const char *format;
-			MsnIMData *imdata = g_new0(MsnIMData, 1);
-			/*
-			 * In MSN, you can't send messages to yourself, so
-			 * we'll fake like we received it ;)
-			 */
-			body_str = msn_message_to_string(msg);
-			body_enc = g_markup_escape_text(body_str, -1);
-			g_free(body_str);
-
-			format = msn_message_get_header_value(msg, "X-MMS-IM-Format");
-			msn_parse_format(format, &pre, &post);
-			body_str = g_strdup_printf("%s%s%s", pre ? pre :  "",
-									   body_enc ? body_enc : "", post ? post : "");
-			g_free(body_enc);
-			g_free(pre);
-			g_free(post);
-
-			serv_got_typing_stopped(gc, who);
-			imdata->gc = gc;
-			imdata->who = who;
-			imdata->msg = body_str;
-			imdata->flags = flags & ~PURPLE_MESSAGE_SEND;
-			imdata->when = time(NULL);
-			purple_timeout_add(0, msn_send_me_im, imdata);
-		}
-
-		msn_message_unref(msg);
-	} else {
-		/*send Offline Instant Message,only to MSN Passport User*/
-		char *friendname;
-
-		purple_debug_info("msn", "prepare to send offline Message\n");
-
-		friendname = msn_encode_mime(account->username);
-		msn_oim_prep_send_msg_info(session->oim,
-			purple_account_get_username(account),
-			friendname, who, msgtext);
-		msn_oim_send_msg(session->oim);
-
-		g_free(msgformat);
-		g_free(msgtext);
-		g_free(friendname);
 	}
+	else
+	{
+		char *body_str, *body_enc, *pre, *post;
+		const char *format;
+		MsnIMData *imdata = g_new0(MsnIMData, 1);
+		/*
+		 * In MSN, you can't send messages to yourself, so
+		 * we'll fake like we received it ;)
+		 */
+		body_str = msn_message_to_string(msg);
+		body_enc = g_markup_escape_text(body_str, -1);
+		g_free(body_str);
+
+		format = msn_message_get_header_value(msg, "X-MMS-IM-Format");
+		msn_parse_format(format, &pre, &post);
+		body_str = g_strdup_printf("%s%s%s", pre ? pre :  "",
+								   body_enc ? body_enc : "", post ? post : "");
+		g_free(body_enc);
+		g_free(pre);
+		g_free(post);
+
+		serv_got_typing_stopped(gc, who);
+		imdata->gc = gc;
+		imdata->who = who;
+		imdata->msg = body_str;
+		imdata->flags = flags & ~PURPLE_MESSAGE_SEND;
+		imdata->when = time(NULL);
+		purple_timeout_add(0, msn_send_me_im, imdata);
+	}
+
+	msn_message_unref(msg);
 
 	return 1;
 }
--- a/libpurple/protocols/msn/msn.h	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/msn.h	Wed Feb 22 05:52:30 2012 +0000
@@ -115,10 +115,10 @@
 #define MSN_SERVER "messenger.hotmail.com"
 #define MSN_HTTPCONN_SERVER "gateway.messenger.hotmail.com"
 #define MSN_PORT 1863
-#define WLM_PROT_VER		16
+#define WLM_PROT_VER		18
 
-#define WLM_MAX_PROTOCOL	16
-#define WLM_MIN_PROTOCOL	15
+#define WLM_MAX_PROTOCOL	18
+#define WLM_MIN_PROTOCOL	18
 
 #define MSN_TYPING_RECV_TIMEOUT 6
 #define MSN_TYPING_SEND_TIMEOUT	4
--- a/libpurple/protocols/msn/msnutils.c	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/msnutils.c	Wed Feb 22 05:52:30 2012 +0000
@@ -490,6 +490,21 @@
 	*ret_port = port;
 }
 
+void
+msn_parse_user(const char *str, char **ret_user, int *ret_network)
+{
+	char **tokens;
+
+	tokens = g_strsplit(str, ":", 2);
+
+	*ret_network = atoi(tokens[0]);
+	*ret_user = tokens[1];
+
+	g_free(tokens[0]);
+	/* tokens[1] is returned */
+	g_free(tokens);
+}
+
 gboolean
 msn_email_is_valid(const char *passport)
 {
--- a/libpurple/protocols/msn/msnutils.h	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/msnutils.h	Wed Feb 22 05:52:30 2012 +0000
@@ -76,6 +76,15 @@
 void msn_parse_socket(const char *str, char **ret_host, int *ret_port);
 
 /**
+ * Parses a user name
+ *
+ * @param str         A network:username string.
+ * @param ret_user    Return of the user's passport.
+ * @param ret_network Return of the user's network.
+ */
+void msn_parse_user(const char *str, char **ret_user, int *ret_network);
+
+/**
  * Verify if the email is a vaild passport.
  *
  * @param passport 	The email
--- a/libpurple/protocols/msn/notification.c	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/notification.c	Wed Feb 22 05:52:30 2012 +0000
@@ -164,10 +164,7 @@
 
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_END);
 
-	if (session->protocol_ver >= 16)
-		trans = msn_transaction_new(cmdproc, "USR", "SSO S %s %s %s", ticket, response, session->guid);
-	else
-		trans = msn_transaction_new(cmdproc, "USR", "SSO S %s %s", ticket, response);
+	trans = msn_transaction_new(cmdproc, "USR", "SSO S %s %s %s", ticket, response, session->guid);
 
 	msn_cmdproc_send_trans(cmdproc, trans);
 }
@@ -359,23 +356,34 @@
 
 /*send Message to Yahoo Messenger*/
 void
-uum_send_msg(MsnSession *session,MsnMessage *msg)
+msn_notification_send_uum(MsnSession *session, MsnMessage *msg)
 {
 	MsnCmdProc *cmdproc;
 	MsnTransaction *trans;
 	char *payload;
 	gsize payload_len;
 	int type;
+	MsnUser *user;
+	int network;
+
+	g_return_if_fail(msg != NULL);
 
 	cmdproc = session->notification->cmdproc;
-	g_return_if_fail(msg     != NULL);
+
 	payload = msn_message_gen_payload(msg, &payload_len);
+	type = msg->type;
+	user = msn_userlist_find_user(session->userlist, msg->remote_user);
+	if (user)
+		network = msn_user_get_network(user);
+	else
+		network = MSN_NETWORK_PASSPORT;
+
 	purple_debug_info("msn",
 		"send UUM, payload{%s}, strlen:%" G_GSIZE_FORMAT ", len:%" G_GSIZE_FORMAT "\n",
 		payload, strlen(payload), payload_len);
-	type = msg->type;
-	trans = msn_transaction_new(cmdproc, "UUM", "%s 32 %d %" G_GSIZE_FORMAT,
-		msg->remote_user, type, payload_len);
+
+	trans = msn_transaction_new(cmdproc, "UUM", "%s %d %d %" G_GSIZE_FORMAT,
+		msg->remote_user, network, type, payload_len);
 	msn_transaction_set_payload(trans, payload, strlen(payload));
 	msn_cmdproc_send_trans(cmdproc, trans);
 }
@@ -390,10 +398,7 @@
 	 * command and we are processing it */
 	if (cmd->payload == NULL) {
 		cmdproc->last_cmd->payload_cb = msg_cmd_post;
-		if (cmdproc->session->protocol_ver >= 16)
-			cmd->payload_len = atoi(cmd->params[5]);
-		else
-			cmd->payload_len = atoi(cmd->params[3]);
+		cmd->payload_len = atoi(cmd->params[5]);
 	} else {
 		g_return_if_fail(cmd->payload_cb != NULL);
 
@@ -1042,7 +1047,7 @@
 		networkid = atoi(cmd->params[3]);
 		friendly = g_strdup(purple_url_decode(cmd->params[4]));
 		clientid = strtoul(cmd->params[5], &extcap_str, 10);
-		if (session->protocol_ver >= 16 && extcap_str && *extcap_str)
+		if (extcap_str && *extcap_str)
 			extcaps = strtoul(extcap_str+1, NULL, 10);
 		else
 			extcaps = 0;
@@ -1056,7 +1061,7 @@
 		networkid = atoi(cmd->params[3]);
 		friendly = g_strdup(purple_url_decode(cmd->params[4]));
 		clientid = strtoul(cmd->params[5], &extcap_str, 10);
-		if (session->protocol_ver >= 16 && extcap_str && *extcap_str)
+		if (extcap_str && *extcap_str)
 			extcaps = strtoul(extcap_str+1, NULL, 10);
 		else
 			extcaps = 0;
@@ -1069,7 +1074,7 @@
 			networkid = atoi(cmd->params[3]);
 			friendly = g_strdup(purple_url_decode(cmd->params[4]));
 			clientid = strtoul(cmd->params[5], &extcap_str, 10);
-			if (session->protocol_ver >= 16 && extcap_str && *extcap_str)
+			if (extcap_str && *extcap_str)
 				extcaps = strtoul(extcap_str+1, NULL, 10);
 			else
 				extcaps = 0;
@@ -1077,7 +1082,7 @@
 			/* MSNP8+ with Display Picture object */
 			friendly = g_strdup(purple_url_decode(cmd->params[3]));
 			clientid = strtoul(cmd->params[4], &extcap_str, 10);
-			if (session->protocol_ver >= 16 && extcap_str && *extcap_str)
+			if (extcap_str && *extcap_str)
 				extcaps = strtoul(extcap_str+1, NULL, 10);
 			else
 				extcaps = 0;
@@ -1087,7 +1092,7 @@
 		/* MSNP8+ without Display Picture object */
 		friendly = g_strdup(purple_url_decode(cmd->params[3]));
 		clientid = strtoul(cmd->params[4], &extcap_str, 10);
-		if (session->protocol_ver >= 16 && extcap_str && *extcap_str)
+		if (extcap_str && *extcap_str)
 			extcaps = strtoul(extcap_str+1, NULL, 10);
 		else
 			extcaps = 0;
@@ -1250,15 +1255,15 @@
 	MsnObject *msnobj;
 	unsigned long clientid, extcaps;
 	char *extcap_str;
+	char *passport;
 	int networkid;
-	const char *state, *passport, *friendly;
+	const char *state, *friendly;
 
 	session = cmdproc->session;
 
-	state    = cmd->params[0];
-	passport = cmd->params[1];
-	networkid = atoi(cmd->params[2]);
-	friendly = purple_url_decode(cmd->params[3]);
+	state = cmd->params[0];
+	msn_parse_user(cmd->params[1], &passport, &networkid);
+	friendly = purple_url_decode(cmd->params[2]);
 
 	user = msn_userlist_find_user(session->userlist, passport);
 	if (user == NULL) return;
@@ -1268,9 +1273,9 @@
 		msn_update_contact(session, passport, MSN_UPDATE_DISPLAY, friendly);
 	}
 
-	if (cmd->param_count == 6)
+	if (cmd->param_count == 5)
 	{
-		msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[5]));
+		msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[4]));
 		msn_user_set_object(user, msnobj);
 	}
 	else
@@ -1278,8 +1283,8 @@
 		msn_user_set_object(user, NULL);
 	}
 
-	clientid = strtoul(cmd->params[4], &extcap_str, 10);
-	if (session->protocol_ver >= 16 && extcap_str && *extcap_str)
+	clientid = strtoul(cmd->params[3], &extcap_str, 10);
+	if (extcap_str && *extcap_str)
 		extcaps = strtoul(extcap_str+1, NULL, 10);
 	else
 		extcaps = 0;
@@ -1292,6 +1297,8 @@
 
 	msn_user_set_state(user, state);
 	msn_user_update(user);
+
+	g_free(passport);
 }
 
 #if 0
@@ -1705,22 +1712,27 @@
 {
 	MsnSession *session;
 	MsnUser *user;
-	const char *passport;
+	char *passport;
+	int network;
 	xmlnode *payloadNode;
 	char *psm_str, *str;
 
 	session = cmdproc->session;
 
-	passport = cmd->params[0];
+	msn_parse_user(cmd->params[0], &passport, &network);
 	user = msn_userlist_find_user(session->userlist, passport);
+
 	if (user == NULL) {
-		char *str = g_strndup(payload, len);
+		str = g_strndup(payload, len);
 		purple_debug_info("msn", "unknown user %s, payload is %s\n",
 			passport, str);
+		g_free(passport);
 		g_free(str);
 		return;
 	}
 
+	g_free(passport);
+
 	/* Free any existing media info for this user */
 	if (user->extinfo) {
 		g_free(user->extinfo->media_album);
@@ -1767,7 +1779,7 @@
 {
 	purple_debug_misc("msn", "UBX received.\n");
 	cmdproc->last_cmd->payload_cb  = ubx_cmd_post;
-	cmd->payload_len = atoi(cmd->params[2]);
+	cmd->payload_len = atoi(cmd->params[1]);
 }
 
 static void
@@ -1812,10 +1824,7 @@
 	epDataNode = xmlnode_new("EndpointData");
 
 	capNode = xmlnode_new_child(epDataNode, "Capabilities");
-	if (session->protocol_ver >= 16)
-		caps = g_strdup_printf("%d:%02d", MSN_CLIENT_ID_CAPABILITIES, MSN_CLIENT_ID_EXT_CAPS);
-	else
-		caps = g_strdup_printf("%d", MSN_CLIENT_ID_CAPABILITIES);
+	caps = g_strdup_printf("%d:%02d", MSN_CLIENT_ID_CAPABILITIES, MSN_CLIENT_ID_EXT_CAPS);
 	xmlnode_insert_data(capNode, caps, -1);
 	g_free(caps);
 
@@ -1942,6 +1951,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	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/notification.h	Wed Feb 22 05:52:30 2012 +0000
@@ -76,8 +76,6 @@
 
 } MsnUnifiedNotificationType;
 
-void uum_send_msg(MsnSession *session, MsnMessage *msg);
-
 void msn_notification_end(void);
 void msn_notification_init(void);
 
@@ -97,6 +95,8 @@
 void msn_notification_disconnect(MsnNotification *notification);
 void msn_notification_dump_contact(MsnSession *session);
 
+void msn_notification_send_uum(MsnSession *session, MsnMessage *msg);
+
 void msn_notification_send_uux(MsnSession *session, const char *payload);
 
 void msn_notification_send_uux_endpointdata(MsnSession *session);
@@ -108,6 +108,8 @@
                                MsnUnifiedNotificationType type,
                                const char *payload);
 
+void msn_notification_send_circle_auth(MsnSession *session, const char *ticket);
+
 /**
  * Closes a notification.
  *
--- a/libpurple/protocols/msn/session.c	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/session.c	Wed Feb 22 05:52:30 2012 +0000
@@ -491,11 +491,10 @@
 		msn_session_sync_users(session);
 	}
 
-	if (session->protocol_ver >= 16) {
-		/* TODO: Send this when updating status instead? */
-		msn_notification_send_uux_endpointdata(session);
-		msn_notification_send_uux_private_endpointdata(session);
-	}
+	/* TODO: Send this when updating status instead? */
+	msn_notification_send_uux_endpointdata(session);
+	msn_notification_send_uux_private_endpointdata(session);
+
 	msn_change_status(session);
 }
 
--- a/libpurple/protocols/msn/state.c	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/state.c	Wed Feb 22 05:52:30 2012 +0000
@@ -186,7 +186,7 @@
 	statusline_stripped = purple_markup_strip_html(statusline);
 	media = create_media_string(presence);
 	g_free(session->psm);
-	session->psm = msn_build_psm(statusline_stripped, media, session->protocol_ver >= 16 ? session->guid : NULL, session->protocol_ver);
+	session->psm = msn_build_psm(statusline_stripped, media, session->guid, session->protocol_ver);
 
 	payload = session->psm;
 
@@ -245,10 +245,8 @@
 
 	if (msnobj == NULL)
 	{
-		if (session->protocol_ver >= 16)
-			trans = msn_transaction_new(cmdproc, "CHG", "%s %u:%02u 0", state_text, caps, MSN_CLIENT_ID_EXT_CAPS);
-		else
-			trans = msn_transaction_new(cmdproc, "CHG", "%s %u", state_text, caps);
+		trans = msn_transaction_new(cmdproc, "CHG", "%s %u:%02u 0", state_text,
+		                            caps, MSN_CLIENT_ID_EXT_CAPS);
 	}
 	else
 	{
@@ -256,12 +254,9 @@
 
 		msnobj_str = msn_object_to_string(msnobj);
 
-		if (session->protocol_ver >= 16)
-			trans = msn_transaction_new(cmdproc, "CHG", "%s %u:%02u %s", state_text,
-							 caps, MSN_CLIENT_ID_EXT_CAPS, purple_url_encode(msnobj_str));
-		else
-			trans = msn_transaction_new(cmdproc, "CHG", "%s %u %s", state_text,
-							 caps, purple_url_encode(msnobj_str));
+		trans = msn_transaction_new(cmdproc, "CHG", "%s %u:%02u %s", state_text,
+		                            caps, MSN_CLIENT_ID_EXT_CAPS,
+		                            purple_url_encode(msnobj_str));
 
 		g_free(msnobj_str);
 	}
--- a/libpurple/protocols/msn/switchboard.c	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Wed Feb 22 05:52:30 2012 +0000
@@ -707,10 +707,7 @@
 ubm_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
 	purple_debug_misc("msn", "get UBM...\n");
-	if (cmdproc->session->protocol_ver >= 16)
-		cmd->payload_len = atoi(cmd->params[5]);
-	else
-		cmd->payload_len = atoi(cmd->params[3]);
+	cmd->payload_len = atoi(cmd->params[5]);
 	cmdproc->last_cmd->payload_cb = msg_cmd_post;
 }
 
@@ -867,12 +864,9 @@
 	swboard = cmdproc->data;
 	g_return_if_fail(swboard != NULL);
 
-	if (servconn->session->protocol_ver >= 16)
-		username = g_strdup_printf("%s;{%s}",
-		                           purple_account_get_username(account),
-		                           servconn->session->guid);
-	else
-		username = g_strdup(purple_account_get_username(account));
+	username = g_strdup_printf("%s;{%s}",
+	                           purple_account_get_username(account),
+	                           servconn->session->guid);
 
 	if (msn_switchboard_is_invited(swboard))
 	{
--- a/libpurple/protocols/msn/user.c	Wed Feb 22 05:32:14 2012 +0000
+++ b/libpurple/protocols/msn/user.c	Wed Feb 22 05:52:30 2012 +0000
@@ -699,6 +699,14 @@
 	return NULL;
 }
 
+MsnNetwork
+msn_user_get_network(const MsnUser *user)
+{
+	g_return_val_if_fail(user != NULL, MSN_NETWORK_UNKNOWN);
+
+	return user->networkid;
+}
+
 MsnObject *
 msn_user_get_object(const MsnUser *user)
 {