changeset 23629:ad68d734205a

merge of '1036d6fc1c09bf3b42c737dab42d188245f16b17' and '5f56f1df972a614a4e7186caa3dafa35b4b77ab1'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 01 Aug 2008 05:16:39 +0000
parents 85189641a970 (current diff) 7a71457cdd32 (diff)
children 46cc31494ff4
files libpurple/protocols/msn/slpsession.c libpurple/protocols/msn/slpsession.h
diffstat 14 files changed, 20 insertions(+), 177 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/Makefile.am	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/Makefile.am	Fri Aug 01 05:16:39 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	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/Makefile.mingw	Fri Aug 01 05:16:39 2008 +0000
@@ -59,7 +59,6 @@
 			slpcall.c \
 			slplink.c \
 			slpmsg.c \
-			slpsession.c \
 			soap.c\
 			state.c \
 			switchboard.c \
--- a/libpurple/protocols/msn/msn.c	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/msn.c	Fri Aug 01 05:16:39 2008 +0000
@@ -594,10 +594,13 @@
 
 	if (ret) {
 		MsnSession *session = gc->proto_data;
-		MsnUser *user = msn_userlist_find_user(session->userlist, who);
-		if (user)
-			ret = (user->clientid & MSN_CLIENT_CAP_WEBMSGR) == 0;
-		/* Include these too: MSN_CLIENT_CAP_MSNMOBILE|MSN_CLIENT_CAP_MSNDIRECT ? */
+		if (session) {
+			MsnUser *user = msn_userlist_find_user(session->userlist, who);
+			if (user)
+				/* Include these too: MSN_CLIENT_CAP_MSNMOBILE|MSN_CLIENT_CAP_MSNDIRECT ? */
+				ret = (user->clientid & MSN_CLIENT_CAP_WEBMSGR) == 0;
+		} else
+			ret = FALSE;
 	}
 
 	return ret;
--- a/libpurple/protocols/msn/nexus.c	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/nexus.c	Fri Aug 01 05:16:39 2008 +0000
@@ -390,7 +390,7 @@
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE);
 
 	username = purple_account_get_username(session->account);
-	password = g_strndup(purple_connection_get_password(session->account->gc), 16);
+	password = g_markup_escape_text(purple_connection_get_password(session->account->gc), 16);
 
 	purple_debug_info("msn", "Logging on %s, with policy '%s', nonce '%s'\n",
 	                  username, nexus->policy, nexus->nonce);
--- a/libpurple/protocols/msn/servconn.c	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/servconn.c	Fri Aug 01 05:16:39 2008 +0000
@@ -391,7 +391,8 @@
 	session = servconn->session;
 
 	len = read(servconn->fd, buf, sizeof(buf) - 1);
-	servconn->session->account->gc->last_received = time(NULL);
+	if (servconn->type == MSN_SERVCONN_NS)
+		servconn->session->account->gc->last_received = time(NULL);
 
 	if (len < 0 && errno == EAGAIN) {
 		return;
--- a/libpurple/protocols/msn/slp.c	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/slp.c	Fri Aug 01 05:16:39 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	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Fri Aug 01 05:16:39 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	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/slpcall.h	Fri Aug 01 05:16:39 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	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/slplink.c	Fri Aug 01 05:16:39 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	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/slplink.h	Fri Aug 01 05:16:39 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	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/slpmsg.h	Fri Aug 01 05:16:39 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	Wed Jul 30 21:09:51 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	Wed Jul 30 21:09:51 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	Wed Jul 30 21:09:51 2008 +0000
+++ b/libpurple/protocols/msn/soap.c	Fri Aug 01 05:16:39 2008 +0000
@@ -38,7 +38,7 @@
 #endif
 
 #define SOAP_TIMEOUT (5 * 60)
-
+#define MSN_UNSAFE_DEBUG 1
 typedef struct _MsnSoapRequest {
 	char *path;
 	MsnSoapMessage *message;