changeset 31243:dfada77da5cb

Reomove MsnMessage reference from DirectConn.
author masca@cpw.pidgin.im
date Thu, 17 Jun 2010 19:54:52 +0000
parents 0678ad30aa65
children 512213d2d301
files libpurple/protocols/msn/directconn.c libpurple/protocols/msn/directconn.h libpurple/protocols/msn/slplink.c libpurple/protocols/msn/slpmsg_part.h
diffstat 4 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c	Thu Jun 17 18:04:42 2010 +0000
+++ b/libpurple/protocols/msn/directconn.c	Thu Jun 17 19:54:52 2010 +0000
@@ -111,8 +111,12 @@
 {
 	g_free(p->data);
 
+#if 0
 	if (p->msg)
 		msn_message_unref(p->msg);
+#endif
+	if (p->part)
+		msn_slpmsgpart_destroy(p->part);
 
 	g_free(p);
 }
@@ -343,7 +347,7 @@
 		if (queue) {
 			while (!g_queue_is_empty(queue)) {
 				MsnDirectConnPacket *p = g_queue_pop_head(queue);
-				msn_slplink_send_msgpart(slplink, p->part);
+				msn_slplink_send_msgpart(slplink, (MsnSlpMessage*)p->part->ack_data);
 				msn_dc_destroy_packet(p);
 			}
 			g_queue_free(queue);
@@ -535,6 +539,14 @@
 static void
 msn_dc_send_packet_cb(MsnDirectConnPacket *p)
 {
+	if (p->part != NULL && p->part->ack_cb != NULL)
+		p->part->ack_cb(p->part, p->part->ack_data);
+}
+
+#if 0
+static void
+msn_dc_send_packet_cb(MsnDirectConnPacket *p)
+{
 	if (p->msg != NULL && p->msg->ack_cb != NULL)
 		p->msg->ack_cb(p->msg, p->msg->ack_data);
 }
@@ -556,6 +568,7 @@
 
 	msn_dc_enqueue_packet(dc, p);
 }
+#endif
 
 void
 msn_dc_enqueue_part(MsnDirectConn *dc, MsnSlpMessagePart *part)
--- a/libpurple/protocols/msn/directconn.h	Thu Jun 17 18:04:42 2010 +0000
+++ b/libpurple/protocols/msn/directconn.h	Thu Jun 17 19:54:52 2010 +0000
@@ -72,7 +72,6 @@
 	guchar      *data;
 
 	void        (*sent_cb)(struct _MsnDirectConnPacket*);
-	MsnMessage  *msg;
 	MsnSlpMessagePart *part;
 };
 
--- a/libpurple/protocols/msn/slplink.c	Thu Jun 17 18:04:42 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Thu Jun 17 19:54:52 2010 +0000
@@ -278,6 +278,7 @@
 		msn_sbconn_send_part(slplink, part);
 	}
 }
+#if 0
 void
 msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg)
 {
@@ -290,6 +291,7 @@
 		msn_sbconn_send_msg(slplink, msg);
 	}
 }
+#endif
 
 void
 msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
@@ -301,6 +303,7 @@
 	/* Maybe we will want to create a new msg for this slpmsg instead of
 	 * reusing the same one all the time. */
 	part = msn_slpmsgpart_new(slpmsg->header, slpmsg->footer);
+	part->ack_data = slpmsg;
 
 	real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size;
 
--- a/libpurple/protocols/msn/slpmsg_part.h	Thu Jun 17 18:04:42 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg_part.h	Thu Jun 17 19:54:52 2010 +0000
@@ -13,6 +13,7 @@
 
 	MsnSlpPartCb ack_cb;
 	MsnSlpPartCb nack_cb;
+	void *ack_data;
 
 	guchar *buffer;
 	size_t size;