changeset 31577:9a23c70bdb7a

Get the P2P version based on the user. Still hard-coded as v1 though.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 09 May 2011 08:06:27 +0000
parents 8f3cb00ad798
children 02ece73986f5
files libpurple/protocols/msn/directconn.c libpurple/protocols/msn/msg.c libpurple/protocols/msn/p2p.c libpurple/protocols/msn/p2p.h libpurple/protocols/msn/slpmsg.c libpurple/protocols/msn/slpmsg_part.c libpurple/protocols/msn/slpmsg_part.h
diffstat 7 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c	Mon May 09 07:08:10 2011 +0000
+++ b/libpurple/protocols/msn/directconn.c	Mon May 09 08:06:27 2011 +0000
@@ -593,7 +593,9 @@
 
 	case DC_STATE_ESTABLISHED:
 		if (packet_length) {
-			part = msn_slpmsgpart_new_from_data(dc->in_buffer + 4, packet_length);
+			MsnP2PVersion p2p;
+			p2p = msn_p2p_get_user_support(dc->slplink->remote_user);
+			part = msn_slpmsgpart_new_from_data(p2p, dc->in_buffer + 4, packet_length);
 			if (part) {
 				msn_slplink_process_msg(dc->slplink, part);
 				msn_slpmsgpart_unref(part);
--- a/libpurple/protocols/msn/msg.c	Mon May 09 07:08:10 2011 +0000
+++ b/libpurple/protocols/msn/msg.c	Mon May 09 08:06:27 2011 +0000
@@ -253,8 +253,10 @@
 
 	if (content_type != NULL &&
 		!strcmp(content_type, "application/x-msnmsgrp2p")) {
+		MsnP2PVersion p2p;
 		msg->msnslp_message = TRUE;
-		msg->part = msn_slpmsgpart_new_from_data(tmp, payload_len - (tmp - tmp_base));
+		p2p = msn_p2p_get_user_support(msg->remote_user);
+		msg->part = msn_slpmsgpart_new_from_data(p2p, tmp, payload_len - (tmp - tmp_base));
 	}
 
 	if (payload_len - (tmp - tmp_base) > 0) {
--- a/libpurple/protocols/msn/p2p.c	Mon May 09 07:08:10 2011 +0000
+++ b/libpurple/protocols/msn/p2p.c	Mon May 09 08:06:27 2011 +0000
@@ -489,6 +489,12 @@
 	}
 }
 
+MsnP2PVersion
+msn_p2p_get_user_support(const char *passport)
+{
+	return MSN_P2P_VERSION_ONE;
+}
+
 guint32
 msn_p2p_info_get_session_id(MsnP2PInfo *info)
 {
--- a/libpurple/protocols/msn/p2p.h	Mon May 09 07:08:10 2011 +0000
+++ b/libpurple/protocols/msn/p2p.h	Mon May 09 08:06:27 2011 +0000
@@ -203,6 +203,9 @@
 void
 msn_p2p_info_init_first(MsnP2PInfo *new_info, MsnP2PInfo *old_info);
 
+MsnP2PVersion
+msn_p2p_get_user_support(const char *passport);
+
 guint32
 msn_p2p_info_get_session_id(MsnP2PInfo *info);
 
--- a/libpurple/protocols/msn/slpmsg.c	Mon May 09 07:08:10 2011 +0000
+++ b/libpurple/protocols/msn/slpmsg.c	Mon May 09 08:06:27 2011 +0000
@@ -37,6 +37,7 @@
 msn_slpmsg_new(MsnSlpLink *slplink, MsnSlpCall *slpcall)
 {
 	MsnSlpMessage *slpmsg;
+	MsnP2PVersion p2p;
 
 	slpmsg = g_new0(MsnSlpMessage, 1);
 
@@ -49,7 +50,8 @@
 		slpmsg->slplink = NULL;
 	slpmsg->slpcall = slpcall;
 
-	slpmsg->p2p_info = msn_p2p_info_new(MSN_P2P_VERSION_ONE);
+	p2p = msn_p2p_get_user_support(slplink->remote_user);
+	slpmsg->p2p_info = msn_p2p_info_new(p2p);
 
 	return slpmsg;
 }
--- a/libpurple/protocols/msn/slpmsg_part.c	Mon May 09 07:08:10 2011 +0000
+++ b/libpurple/protocols/msn/slpmsg_part.c	Mon May 09 08:06:27 2011 +0000
@@ -42,14 +42,15 @@
 	return msn_slpmsgpart_ref(part);
 }
 
-MsnSlpMessagePart *msn_slpmsgpart_new_from_data(const char *data, size_t data_len)
+MsnSlpMessagePart *
+msn_slpmsgpart_new_from_data(MsnP2PVersion p2p, const char *data, size_t data_len)
 {
 	MsnSlpMessagePart *part;
 	MsnP2PInfo *info;
 	size_t len;
 	int body_len;
 
-	info = msn_p2p_info_new(MSN_P2P_VERSION_ONE);
+	info = msn_p2p_info_new(p2p);
 
 	/* Extract the binary SLP header */
 	len = msn_p2p_header_from_wire(info, data, data_len);
--- a/libpurple/protocols/msn/slpmsg_part.h	Mon May 09 07:08:10 2011 +0000
+++ b/libpurple/protocols/msn/slpmsg_part.h	Mon May 09 08:06:27 2011 +0000
@@ -46,7 +46,7 @@
 
 MsnSlpMessagePart *msn_slpmsgpart_new(MsnP2PInfo *info);
 
-MsnSlpMessagePart *msn_slpmsgpart_new_from_data(const char *data, size_t data_len);
+MsnSlpMessagePart *msn_slpmsgpart_new_from_data(MsnP2PVersion p2p, const char *data, size_t data_len);
 
 MsnSlpMessagePart *msn_slpmsgpart_ref(MsnSlpMessagePart *part);