soc.2010.msn-tlc: ec024f76: Reomove MsnMessage reference from Direct...

masca at cpw.pidgin.im masca at cpw.pidgin.im
Mon Jun 21 03:17:02 EDT 2010


-----------------------------------------------------------------
Revision: ec024f76c6b37b84ce335f525fcc2dada004096d
Ancestor: a00534e649cfe73cc560f4317893664325a4fee2
Author: masca at cpw.pidgin.im
Date: 2010-06-17T19:54:52
Branch: im.pidgin.soc.2010.msn-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/ec024f76c6b37b84ce335f525fcc2dada004096d

Modified files:
        libpurple/protocols/msn/directconn.c
        libpurple/protocols/msn/directconn.h
        libpurple/protocols/msn/slplink.c
        libpurple/protocols/msn/slpmsg_part.h

ChangeLog: 

Reomove MsnMessage reference from DirectConn.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/directconn.c	25bec9e8e688043a2de2d0918dbadf0d4ffa043d
+++ libpurple/protocols/msn/directconn.c	7afe7a119ed7eb861dc241d0eed931bb9b47702a
@@ -111,8 +111,12 @@ msn_dc_destroy_packet(MsnDirectConnPacke
 {
 	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 @@ msn_dc_fallback_to_sb(MsnDirectConn *dc)
 		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 @@ msn_dc_send_packet_cb(MsnDirectConnPacke
 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_msg(MsnDirectConn *dc, Ms
 
 	msn_dc_enqueue_packet(dc, p);
 }
+#endif
 
 void
 msn_dc_enqueue_part(MsnDirectConn *dc, MsnSlpMessagePart *part)
============================================================
--- libpurple/protocols/msn/directconn.h	ce7a53ef577c22c2e8506ee6d011c109058a60a2
+++ libpurple/protocols/msn/directconn.h	36acba2537d319849d7af08e81a6c570565339f3
@@ -72,7 +72,6 @@ struct _MsnDirectConnPacket {
 	guchar      *data;
 
 	void        (*sent_cb)(struct _MsnDirectConnPacket*);
-	MsnMessage  *msg;
 	MsnSlpMessagePart *part;
 };
 
============================================================
--- libpurple/protocols/msn/slplink.c	1534e2a46d37c04fa0a1bc79ddcfd5b3e6c39ca2
+++ libpurple/protocols/msn/slplink.c	a6c7afef02f2f0fb269f284a1c43e7342a38748e
@@ -278,6 +278,7 @@ msn_slplink_send_part(MsnSlpLink *slplin
 		msn_sbconn_send_part(slplink, part);
 	}
 }
+#if 0
 void
 msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg)
 {
@@ -290,6 +291,7 @@ msn_slplink_send_msg(MsnSlpLink *slplink
 		msn_sbconn_send_msg(slplink, msg);
 	}
 }
+#endif
 
 void
 msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
@@ -301,6 +303,7 @@ msn_slplink_send_msgpart(MsnSlpLink *slp
 	/* 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;
 
============================================================
--- libpurple/protocols/msn/slpmsg_part.h	caed71263d5b10963b84e99598d45e8bf64bba13
+++ libpurple/protocols/msn/slpmsg_part.h	175cc10b10442e9f28bdb1227e916098bbc06fef
@@ -13,6 +13,7 @@ struct _MsnSlpMessagePart
 
 	MsnSlpPartCb ack_cb;
 	MsnSlpPartCb nack_cb;
+	void *ack_data;
 
 	guchar *buffer;
 	size_t size;


More information about the Commits mailing list