changeset 31584:cf702c6ab9e7

Getting the P2P version is probably the slplink's job, since it has the rest of the information we need, like the session, which gives us the userlist, etc.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 09 May 2011 22:56:29 +0000
parents 5a6c5a4f1aea
children 1e657ff2eacb
files libpurple/protocols/msn/directconn.c libpurple/protocols/msn/msg.c libpurple/protocols/msn/p2p.c libpurple/protocols/msn/p2p.h libpurple/protocols/msn/slplink.c libpurple/protocols/msn/slplink.h libpurple/protocols/msn/slpmsg.c
diffstat 7 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c	Mon May 09 22:50:05 2011 +0000
+++ b/libpurple/protocols/msn/directconn.c	Mon May 09 22:56:29 2011 +0000
@@ -594,7 +594,7 @@
 	case DC_STATE_ESTABLISHED:
 		if (packet_length) {
 			MsnP2PVersion p2p;
-			p2p = msn_p2p_get_user_support(dc->slplink->remote_user);
+			p2p = msn_slplink_get_p2p_version(dc->slplink);
 			part = msn_slpmsgpart_new_from_data(p2p, dc->in_buffer + 4, packet_length);
 			if (part) {
 				msn_slplink_process_msg(dc->slplink, part);
--- a/libpurple/protocols/msn/msg.c	Mon May 09 22:50:05 2011 +0000
+++ b/libpurple/protocols/msn/msg.c	Mon May 09 22:56:29 2011 +0000
@@ -864,7 +864,7 @@
 		}
 	}
 
-	p2p = msn_p2p_get_user_support(msg->remote_user);
+	p2p = msn_slplink_get_p2p_version(slplink);
 	msg->part = msn_slpmsgpart_new_from_data(p2p, msg->body, msg->body_len);
 
 	if (msg->part)
--- a/libpurple/protocols/msn/p2p.c	Mon May 09 22:50:05 2011 +0000
+++ b/libpurple/protocols/msn/p2p.c	Mon May 09 22:56:29 2011 +0000
@@ -489,12 +489,6 @@
 	}
 }
 
-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 22:50:05 2011 +0000
+++ b/libpurple/protocols/msn/p2p.h	Mon May 09 22:56:29 2011 +0000
@@ -203,9 +203,6 @@
 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/slplink.c	Mon May 09 22:50:05 2011 +0000
+++ b/libpurple/protocols/msn/slplink.c	Mon May 09 22:56:29 2011 +0000
@@ -79,6 +79,7 @@
 	slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4;
 
 	slplink->remote_user = g_strdup(username);
+	slplink->p2p_version = MSN_P2P_VERSION_ONE;
 
 	slplink->slp_msg_queue = g_queue_new();
 
@@ -264,6 +265,12 @@
 	return NULL;
 }
 
+MsnP2PVersion
+msn_slplink_get_p2p_version(MsnSlpLink *slplink)
+{
+	return slplink->p2p_version;
+}
+
 static void
 msn_slplink_send_part(MsnSlpLink *slplink, MsnSlpMessagePart *part)
 {
--- a/libpurple/protocols/msn/slplink.h	Mon May 09 22:50:05 2011 +0000
+++ b/libpurple/protocols/msn/slplink.h	Mon May 09 22:56:29 2011 +0000
@@ -45,6 +45,7 @@
 	guint refs;
 
 	char *remote_user;
+	MsnP2PVersion p2p_version;
 
 	int slp_seq_id;
 
@@ -75,6 +76,8 @@
 MsnSlpCall *msn_slplink_find_slp_call(MsnSlpLink *slplink,
 									  const char *id);
 MsnSlpCall *msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id);
+MsnP2PVersion msn_slplink_get_p2p_version(MsnSlpLink *slplink);
+
 void msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg);
 void msn_slplink_send_slpmsg(MsnSlpLink *slplink,
 							 MsnSlpMessage *slpmsg);
--- a/libpurple/protocols/msn/slpmsg.c	Mon May 09 22:50:05 2011 +0000
+++ b/libpurple/protocols/msn/slpmsg.c	Mon May 09 22:56:29 2011 +0000
@@ -49,7 +49,7 @@
 	msn_slpmsg_set_slplink(slpmsg, slplink);
 	slpmsg->slpcall = slpcall;
 
-	p2p = msn_p2p_get_user_support(slplink->remote_user);
+	p2p = msn_slplink_get_p2p_version(slplink);
 	slpmsg->p2p_info = msn_p2p_info_new(p2p);
 
 	return slpmsg;