changeset 23626:96e78c0fa32b

Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall and then copy some data from it. Fixes #1671.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 01 Aug 2008 02:04:36 +0000
parents 7e2673925be6
children 24f6212d1996
files libpurple/protocols/msn/Makefile.am libpurple/protocols/msn/Makefile.mingw libpurple/protocols/msn/slp.c libpurple/protocols/msn/slpcall.c libpurple/protocols/msn/slpcall.h libpurple/protocols/msn/slplink.c libpurple/protocols/msn/slplink.h libpurple/protocols/msn/slpmsg.h libpurple/protocols/msn/slpsession.c libpurple/protocols/msn/slpsession.h libpurple/protocols/msn/soap.c
diffstat 11 files changed, 10 insertions(+), 171 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/Makefile.am	Fri Aug 01 02:02:07 2008 +0000
+++ b/libpurple/protocols/msn/Makefile.am	Fri Aug 01 02:04:36 2008 +0000
@@ -48,8 +48,6 @@
 	slplink.h \
 	slpmsg.c \
 	slpmsg.h \
-	slpsession.c \
-	slpsession.h \
 	soap.c \
 	soap.h \
 	state.c \
--- a/libpurple/protocols/msn/Makefile.mingw	Fri Aug 01 02:02:07 2008 +0000
+++ b/libpurple/protocols/msn/Makefile.mingw	Fri Aug 01 02:04:36 2008 +0000
@@ -59,7 +59,6 @@
 			slpcall.c \
 			slplink.c \
 			slpmsg.c \
-			slpsession.c \
 			soap.c\
 			state.c \
 			switchboard.c \
--- a/libpurple/protocols/msn/slp.c	Fri Aug 01 02:02:07 2008 +0000
+++ b/libpurple/protocols/msn/slp.c	Fri Aug 01 02:04:36 2008 +0000
@@ -25,7 +25,6 @@
 #include "slp.h"
 #include "slpcall.h"
 #include "slpmsg.h"
-#include "slpsession.h"
 
 #include "object.h"
 #include "user.h"
@@ -256,7 +255,6 @@
 		/* Emoticon or UserDisplay */
 		char *content;
 		gsize len;
-		MsnSlpSession *slpsession;
 		MsnSlpLink *slplink;
 		MsnSlpMessage *slpmsg;
 		MsnObject *obj;
@@ -306,14 +304,10 @@
 			g_return_if_reached();
 		}
 
-		slpsession = msn_slplink_find_slp_session(slplink,
-												  slpcall->session_id);
-
 		/* DATA PREP */
 		slpmsg = msn_slpmsg_new(slplink);
 		slpmsg->slpcall = slpcall;
-		slpmsg->slpsession = slpsession;
-		slpmsg->session_id = slpsession->id;
+		slpmsg->session_id = slpcall->session_id;
 		msn_slpmsg_set_body(slpmsg, NULL, 4);
 #ifdef MSN_DEBUG_SLP
 		slpmsg->info = "SLP DATA PREP";
@@ -323,7 +317,6 @@
 		/* DATA */
 		slpmsg = msn_slpmsg_new(slplink);
 		slpmsg->slpcall = slpcall;
-		slpmsg->slpsession = slpsession;
 		slpmsg->flags = 0x20;
 #ifdef MSN_DEBUG_SLP
 		slpmsg->info = "SLP DATA";
--- a/libpurple/protocols/msn/slpcall.c	Fri Aug 01 02:02:07 2008 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Fri Aug 01 02:04:36 2008 +0000
@@ -24,7 +24,6 @@
 #include "msn.h"
 #include "msnutils.h"
 #include "slpcall.h"
-#include "slpsession.h"
 
 #include "slp.h"
 
@@ -115,12 +114,8 @@
 void
 msn_slp_call_session_init(MsnSlpCall *slpcall)
 {
-	MsnSlpSession *slpsession;
-
-	slpsession = msn_slp_session_new(slpcall);
-
 	if (slpcall->session_init_cb)
-		slpcall->session_init_cb(slpsession);
+		slpcall->session_init_cb(slpcall);
 
 	slpcall->started = TRUE;
 }
--- a/libpurple/protocols/msn/slpcall.h	Fri Aug 01 02:02:07 2008 +0000
+++ b/libpurple/protocols/msn/slpcall.h	Fri Aug 01 02:04:36 2008 +0000
@@ -29,7 +29,6 @@
 typedef struct _MsnSlpCall MsnSlpCall;
 
 #include "slplink.h"
-#include "slpsession.h"
 
 /* The official client seems to timeout slp calls after 5 minutes */
 #define MSN_SLPCALL_TIMEOUT 300000
@@ -66,7 +65,7 @@
 
 	void (*progress_cb)(MsnSlpCall *slpcall,
 						gsize total_length, gsize len, gsize offset);
-	void (*session_init_cb)(MsnSlpSession *slpsession);
+	void (*session_init_cb)(MsnSlpCall *slpcall);
 
 	/* Can be checksum, or smile */
 	char *data_info;
--- a/libpurple/protocols/msn/slplink.c	Fri Aug 01 02:02:07 2008 +0000
+++ b/libpurple/protocols/msn/slplink.c	Fri Aug 01 02:04:36 2008 +0000
@@ -154,23 +154,6 @@
 	return slplink;
 }
 
-MsnSlpSession *
-msn_slplink_find_slp_session(MsnSlpLink *slplink, long session_id)
-{
-	GList *l;
-	MsnSlpSession *slpsession;
-
-	for (l = slplink->slp_sessions; l != NULL; l = l->next)
-	{
-		slpsession = l->data;
-
-		if (slpsession->id == session_id)
-			return slpsession;
-	}
-
-	return NULL;
-}
-
 void
 msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall)
 {
@@ -394,12 +377,12 @@
 	}
 	else if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030)
 	{
-		MsnSlpSession *slpsession;
-		slpsession = slpmsg->slpsession;
+		MsnSlpCall *slpcall;
+		slpcall = slpmsg->slpcall;
 
-		g_return_if_fail(slpsession != NULL);
-		msg->msnslp_header.session_id = slpsession->id;
-		msg->msnslp_footer.value = slpsession->app_id;
+		g_return_if_fail(slpcall != NULL);
+		msg->msnslp_header.session_id = slpcall->session_id;
+		msg->msnslp_footer.value = slpcall->app_id;
 		msg->msnslp_header.ack_id = rand() % 0xFFFFFF00;
 	}
 	else if (slpmsg->flags == 0x100)
@@ -476,18 +459,15 @@
 }
 
 static void
-send_file_cb(MsnSlpSession *slpsession)
+send_file_cb(MsnSlpCall *slpcall)
 {
-	MsnSlpCall *slpcall;
 	MsnSlpMessage *slpmsg;
 	struct stat st;
 	PurpleXfer *xfer;
 
-	slpcall = slpsession->slpcall;
 	slpmsg = msn_slpmsg_new(slpcall->slplink);
 	slpmsg->slpcall = slpcall;
 	slpmsg->flags = 0x1000030;
-	slpmsg->slpsession = slpsession;
 #ifdef MSN_DEBUG_SLP
 	slpmsg->info = "SLP FILE";
 #endif
--- a/libpurple/protocols/msn/slplink.h	Fri Aug 01 02:02:07 2008 +0000
+++ b/libpurple/protocols/msn/slplink.h	Fri Aug 01 02:04:36 2008 +0000
@@ -53,7 +53,6 @@
 	MsnDirectConn *directconn;
 
 	GList *slp_calls;
-	GList *slp_sessions;
 	GList *slp_msgs;
 
 	GQueue *slp_msg_queue;
@@ -74,8 +73,6 @@
  */
 MsnSlpLink *msn_session_get_slplink(MsnSession *session, const char *username);
 
-MsnSlpSession *msn_slplink_find_slp_session(MsnSlpLink *slplink,
-											long session_id);
 void msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall);
 void msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall);
 MsnSlpCall *msn_slplink_find_slp_call(MsnSlpLink *slplink,
--- a/libpurple/protocols/msn/slpmsg.h	Fri Aug 01 02:02:07 2008 +0000
+++ b/libpurple/protocols/msn/slpmsg.h	Fri Aug 01 02:04:36 2008 +0000
@@ -28,7 +28,6 @@
 
 #include "imgstore.h"
 
-#include "slpsession.h"
 #include "slpcall.h"
 #include "slplink.h"
 #include "session.h"
@@ -42,7 +41,6 @@
  */
 struct _MsnSlpMessage
 {
-	MsnSlpSession *slpsession;
 	MsnSlpCall *slpcall; /**< The slpcall to which this slp message belongs (if applicable). */
 	MsnSlpLink *slplink; /**< The slplink through which this slp message is being sent. */
 	MsnSession *session;
--- a/libpurple/protocols/msn/slpsession.c	Fri Aug 01 02:02:07 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/**
- * @file slpsession.h SLP Session functions
- *
- * purple
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here.  Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
- */
-#include "slpsession.h"
-
-/**************************************************************************
- * SLP Session
- **************************************************************************/
-
-MsnSlpSession *
-msn_slp_session_new(MsnSlpCall *slpcall)
-{
-	MsnSlpSession *slpsession;
-
-	g_return_val_if_fail(slpcall != NULL, NULL);
-
-	slpsession = g_new0(MsnSlpSession, 1);
-
-	slpsession->slpcall = slpcall;
-	slpsession->id = slpcall->session_id;
-	slpsession->app_id = slpcall->app_id;
-
-	slpcall->slplink->slp_sessions =
-		g_list_append(slpcall->slplink->slp_sessions, slpsession);
-
-	return slpsession;
-}
-
-void
-msn_slp_session_destroy(MsnSlpSession *slpsession)
-{
-	g_return_if_fail(slpsession != NULL);
-
-	slpsession->slpcall->slplink->slp_sessions =
-		g_list_remove(slpsession->slpcall->slplink->slp_sessions, slpsession);
-
-	g_free(slpsession);
-}
-
-#if 0
-static void
-msn_slp_session_send_slpmsg(MsnSlpSession *slpsession, MsnSlpMessage *slpmsg)
-{
-	slpmsg->slpsession = slpsession;
-
-#if 0
-	slpmsg->session_id = slpsession->id;
-	slpmsg->app_id = slpsession->app_id;
-#endif
-
-	msn_slplink_send_slpmsg(slpsession->slpcall->slplink, slpmsg);
-}
-#endif
--- a/libpurple/protocols/msn/slpsession.h	Fri Aug 01 02:02:07 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/**
- * @file slpsession.h SLP Session functions
- *
- * purple
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here.  Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
- */
-#ifndef _MSN_SLPSESSION_H_
-#define _MSN_SLPSESSION_H_
-
-typedef struct _MsnSlpSession MsnSlpSession;
-
-#include "slpcall.h"
-#include "slpsession.h"
-#include "slpmsg.h"
-
-struct _MsnSlpSession
-{
-	/* MsnSlpLink *slplink; */
-	MsnSlpCall *slpcall;
-
-	long id;
-
-	long app_id;
-};
-
-MsnSlpSession *msn_slp_session_new(MsnSlpCall *slpcall);
-void msn_slp_session_destroy(MsnSlpSession *slpsession);
-void msn_slpsession_send_slpmsg(MsnSlpSession *slpsession,
-								MsnSlpMessage *slpmsg);
-#endif /* _MSN_SLPSESSION_H_ */
--- a/libpurple/protocols/msn/soap.c	Fri Aug 01 02:02:07 2008 +0000
+++ b/libpurple/protocols/msn/soap.c	Fri Aug 01 02:04:36 2008 +0000
@@ -38,7 +38,7 @@
 #endif
 
 #define SOAP_TIMEOUT (5 * 60)
-
+#define MSN_UNSAFE_DEBUG 1
 typedef struct _MsnSoapRequest {
 	char *path;
 	MsnSoapMessage *message;