pidgin: c1584182: Drop support for protocols below 18.

qulogic at pidgin.im qulogic at pidgin.im
Mon Feb 6 17:30:46 EST 2012


----------------------------------------------------------------------
Revision: c1584182b85f99fa3507ea3f76b07865ee7e43f7
Parent:   85947d1d1e7c589daf8cd288a2fefd18888cb110
Author:   qulogic at pidgin.im
Date:     02/06/12 17:24:04
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c1584182b85f99fa3507ea3f76b07865ee7e43f7

Changelog: 

Drop support for protocols below 18.

Changes against parent 85947d1d1e7c589daf8cd288a2fefd18888cb110

  patched  libpurple/protocols/msn/contact.c
  patched  libpurple/protocols/msn/msn.c
  patched  libpurple/protocols/msn/notification.c
  patched  libpurple/protocols/msn/session.c
  patched  libpurple/protocols/msn/state.c
  patched  libpurple/protocols/msn/switchboard.c

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	007dde8abcf1c06248f75ab657cb76f2aced3390
+++ libpurple/protocols/msn/msn.c	e3ef661d19992f69e9c5da1adc7a618de9b37bb8
@@ -1223,7 +1223,7 @@ msn_actions(PurplePlugin *plugin, gpoint
 	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);
============================================================
--- libpurple/protocols/msn/switchboard.c	b9c0b6f6d4ccef969a653349eabd0dcee49ff81a
+++ libpurple/protocols/msn/switchboard.c	ff8b05cd26c5a35b06466f2deda8950ffae1b034
@@ -707,10 +707,7 @@ ubm_cmd(MsnCmdProc *cmdproc, MsnCommand 
 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 @@ connect_cb(MsnServConn *servconn)
 	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))
 	{
============================================================
--- libpurple/protocols/msn/notification.c	0e774168b07c1393eb354a53c53e7cc5da81043b
+++ libpurple/protocols/msn/notification.c	52a01d0d5b1491a19c5d2b18371b2f2f99ddc263
@@ -164,10 +164,7 @@ msn_got_login_params(MsnSession *session
 
 	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);
 }
@@ -401,10 +398,7 @@ ubm_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	 * 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);
 
@@ -1053,7 +1047,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand 
 		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;
@@ -1067,7 +1061,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand 
 		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;
@@ -1080,7 +1074,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand 
 			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;
@@ -1088,7 +1082,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand 
 			/* 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;
@@ -1098,7 +1092,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand 
 		/* 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;
@@ -1267,16 +1261,9 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand 
 
 	session = cmdproc->session;
 
-	state    = cmd->params[0];
-	if (session->protocol_ver >= 18) {
-		const char *tmp = cmd->params[1];
-		msn_parse_user(tmp, &passport, &networkid);
-		friendly = purple_url_decode(cmd->params[2]);
-	} else {
-		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;
@@ -1297,7 +1284,7 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	}
 
 	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;
@@ -1311,8 +1298,7 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	msn_user_set_state(user, state);
 	msn_user_update(user);
 
-	if (session->protocol_ver >= 18)
-		g_free(passport);
+	g_free(passport);
 }
 
 #if 0
@@ -1733,23 +1719,19 @@ ubx_cmd_post(MsnCmdProc *cmdproc, MsnCom
 
 	session = cmdproc->session;
 
-	if (session->protocol_ver >= 18) {
-		str = cmd->params[0];
-		msn_parse_user(str, &passport, &network);
-	} else {
-		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;
 	}
 
-	if (session->protocol_ver >= 18)
-		g_free(passport);
+	g_free(passport);
 
 	/* Free any existing media info for this user */
 	if (user->extinfo) {
@@ -1797,10 +1779,7 @@ ubx_cmd(MsnCmdProc *cmdproc, MsnCommand 
 {
 	purple_debug_misc("msn", "UBX received.\n");
 	cmdproc->last_cmd->payload_cb  = ubx_cmd_post;
-	if (cmdproc->session->protocol_ver >= 18)
-		cmd->payload_len = atoi(cmd->params[1]);
-	else
-		cmd->payload_len = atoi(cmd->params[2]);
+	cmd->payload_len = atoi(cmd->params[1]);
 }
 
 static void
@@ -1845,10 +1824,7 @@ void msn_notification_send_uux_endpointd
 	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);
 
============================================================
--- libpurple/protocols/msn/session.c	942c0db801f3605c4ee4b56cfb23853109c5dbbb
+++ libpurple/protocols/msn/session.c	3ab4076f24bd622fa73a4937107f4f216353502c
@@ -491,11 +491,10 @@ msn_session_finish_login(MsnSession *ses
 		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);
 }
 
============================================================
--- libpurple/protocols/msn/state.c	32d23c9160735eaf6c155cb31718afac858ebfeb
+++ libpurple/protocols/msn/state.c	728f3eeddfee4a1c2b392edeaca80a355145c3c8
@@ -186,7 +186,7 @@ msn_set_psm(MsnSession *session)
 	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 @@ msn_change_status(MsnSession *session)
 
 	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 @@ msn_change_status(MsnSession *session)
 
 		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);
 	}
============================================================
--- libpurple/protocols/msn/contact.c	03b4dbe2efc8d811e6e5315744eadf720f67d712
+++ libpurple/protocols/msn/contact.c	8a1024b7df24c804ea66ac6325f2f7816b6aa2e1
@@ -865,6 +865,21 @@ msn_parse_addressbook_contacts(MsnSessio
 	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)
 {
@@ -956,13 +971,9 @@ msn_parse_addressbook(MsnSession *sessio
 		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);
+	circleNode = xmlnode_get_child(result, "CircleResult");
+	if (circleNode != NULL) {
+		msn_parse_addressbook_circles(session, circleNode);
 	}
 
 	return TRUE;


More information about the Commits mailing list