changeset 31246:07a9356ad2e0

Remove the MsnMessage from SlpMessage.
author masca@cpw.pidgin.im
date Sat, 19 Jun 2010 21:48:19 +0000
parents b7a814c4c4e9
children 5f062e882b52
files libpurple/protocols/msn/sbconn.c libpurple/protocols/msn/slp.c libpurple/protocols/msn/slplink.c libpurple/protocols/msn/slpmsg.h
diffstat 4 files changed, 30 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/sbconn.c	Thu Jun 17 20:02:30 2010 +0000
+++ b/libpurple/protocols/msn/sbconn.c	Sat Jun 19 21:48:19 2010 +0000
@@ -81,11 +81,15 @@
 void msn_sbconn_send_part(MsnSlpLink *slplink, MsnSlpMessagePart *part)
 {
 	MsnMessage *msg;
+	const char *passport;
 	char *data;
 	size_t size;
 
 	msg = msn_message_new_msnslp();
 
+	passport = purple_normalize(slplink->session->account, slplink->remote_user);
+	msn_message_set_header(msg, "P2P-Dest", passport);
+
 	data = msn_slpmsgpart_serialize(part, &size);
 	msg->part = part;
 
--- a/libpurple/protocols/msn/slp.c	Thu Jun 17 20:02:30 2010 +0000
+++ b/libpurple/protocols/msn/slp.c	Sat Jun 19 21:48:19 2010 +0000
@@ -155,7 +155,6 @@
 	slpcall->u.outgoing.len = len;
 	slpcall->u.outgoing.data = data;
 	msn_slplink_send_msgpart(slpcall->slplink, slpcall->xfer_msg);
-	msn_message_unref(slpcall->xfer_msg->msg);
 	return MIN(1202, len);
 }
 
--- a/libpurple/protocols/msn/slplink.c	Thu Jun 17 20:02:30 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Sat Jun 19 21:48:19 2010 +0000
@@ -34,6 +34,7 @@
 #include "slp.h"
 #include "p2p.h"
 
+#if 0
 #ifdef MSN_DEBUG_SLP_FILES
 static int m_sc = 0;
 static int m_rc = 0;
@@ -58,6 +59,7 @@
 	g_free(tmp);
 }
 #endif
+#endif /* 0 */
 
 /**************************************************************************
  * Main
@@ -333,11 +335,11 @@
 	/* TODO: port this function to SlpMessageParts */
 	if (purple_debug_is_verbose())
 		msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body);
-#endif
 
 #ifdef MSN_DEBUG_SLP_FILES
 	debug_msg_to_file(msg, TRUE);
 #endif
+#endif
 
 	slpmsg->parts = g_list_append(slpmsg->parts, part);
 	msn_slplink_send_part(slplink, part);
@@ -362,26 +364,21 @@
 static void
 msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
 {
-	MsnMessage *msg;
-	const char *passport;
-
-	slpmsg->msg = msg = msn_message_new_msnslp();
-
-	msg->slpmsg = slpmsg;
-	msg->slpmsg->header = g_new0(MsnP2PHeader, 1);
-	msg->slpmsg->footer = g_new0(MsnP2PFooter, 1);
+	slpmsg = slpmsg;
+	slpmsg->header = g_new0(MsnP2PHeader, 1);
+	slpmsg->footer = g_new0(MsnP2PFooter, 1);
 
 	if (slpmsg->flags == P2P_NO_FLAG)
 	{
-		msg->slpmsg->header->session_id = slpmsg->session_id;
-		msg->slpmsg->header->ack_id = rand() % 0xFFFFFF00;
+		slpmsg->header->session_id = slpmsg->session_id;
+		slpmsg->header->ack_id = rand() % 0xFFFFFF00;
 	}
 	else if (slpmsg->flags == P2P_ACK)
 	{
-		msg->slpmsg->header->session_id = slpmsg->session_id;
-		msg->slpmsg->header->ack_id = slpmsg->ack_id;
-		msg->slpmsg->header->ack_size = slpmsg->ack_size;
-		msg->slpmsg->header->ack_sub_id = slpmsg->ack_sub_id;
+		slpmsg->header->session_id = slpmsg->session_id;
+		slpmsg->header->ack_id = slpmsg->ack_id;
+		slpmsg->header->ack_size = slpmsg->ack_size;
+		slpmsg->header->ack_sub_id = slpmsg->ack_sub_id;
 	}
 	else if (slpmsg->flags == P2P_MSN_OBJ_DATA ||
 	         slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
@@ -391,22 +388,25 @@
 		slpcall = slpmsg->slpcall;
 
 		g_return_if_fail(slpcall != NULL);
-		msg->slpmsg->header->session_id = slpcall->session_id;
-		msg->slpmsg->footer->value = slpcall->app_id;
-		msg->slpmsg->header->ack_id = rand() % 0xFFFFFF00;
+		slpmsg->header->session_id = slpcall->session_id;
+		slpmsg->footer->value = slpcall->app_id;
+		slpmsg->header->ack_id = rand() % 0xFFFFFF00;
 	}
 	else if (slpmsg->flags == 0x100)
 	{
-		msg->slpmsg->header->ack_id     = slpmsg->ack_id;
-		msg->slpmsg->header->ack_sub_id = slpmsg->ack_sub_id;
-		msg->slpmsg->header->ack_size   = slpmsg->ack_size;
+		slpmsg->header->ack_id     = slpmsg->ack_id;
+		slpmsg->header->ack_sub_id = slpmsg->ack_sub_id;
+		slpmsg->header->ack_size   = slpmsg->ack_size;
 	}
 
-	msg->slpmsg->header->id = slpmsg->id;
-	msg->slpmsg->header->flags = (guint32)slpmsg->flags;
+	slpmsg->header->id = slpmsg->id;
+	slpmsg->header->flags = (guint32)slpmsg->flags;
 
-	msg->slpmsg->header->total_size = slpmsg->size;
+	slpmsg->header->total_size = slpmsg->size;
 
+	msn_slplink_send_msgpart(slplink, slpmsg);
+
+#if 0
 	passport = purple_normalize(slplink->session->account, slplink->remote_user);
 	msn_message_set_header(msg, "P2P-Dest", passport);
 
@@ -417,6 +417,7 @@
 	msn_slplink_send_msgpart(slplink, slpmsg);
 
 	msn_message_destroy(msg);
+#endif
 }
 
 void
--- a/libpurple/protocols/msn/slpmsg.h	Thu Jun 17 20:02:30 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg.h	Sat Jun 19 21:48:19 2010 +0000
@@ -78,7 +78,7 @@
 	GList *msgs; /**< The real messages. */
 	GList *parts; /**< A list with the SlpMsgParts */
 
-#if 1
+#if 0
 	MsnMessage *msg; /**< The temporary real message that will be sent. */
 #endif