changeset 31564:5de2d1b3669c

Use the serializing function for SlpMsgParts on a direct connection. But it seems like a DC doesn't have a footer, which we may or may not be parsing correctly when receiving.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 06 Jan 2011 05:12:00 +0000
parents b2bb0d04d659
children 3824f34c93d9
files libpurple/protocols/msn/directconn.c
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c	Thu Jan 06 04:15:28 2011 +0000
+++ b/libpurple/protocols/msn/directconn.c	Thu Jan 06 05:12:00 2011 +0000
@@ -539,13 +539,11 @@
 msn_dc_enqueue_part(MsnDirectConn *dc, MsnSlpMessagePart *part)
 {
 	MsnDirectConnPacket *p;
-	guint32 length;
+	size_t length;
 
-	length = part->size + P2P_PACKET_HEADER_SIZE;
-	p = msn_dc_new_packet(length);
-
-	memcpy(p->data, part->header, P2P_PACKET_HEADER_SIZE);
-	memcpy(p->data + P2P_PACKET_HEADER_SIZE, part->buffer, part->size);
+	p = msn_dc_new_packet(0);
+	p->data = (guchar *)msn_slpmsgpart_serialize(part, &length);
+	p->length = length - P2P_PACKET_FOOTER_SIZE; /* DC doesn't need footer? */
 
 	p->sent_cb = msn_dc_send_packet_cb;
 	p->part = msn_slpmsgpart_ref(part);