changeset 31235:efe9b0338606

Add a function that enqueue a Part instead of a Message since directconn does not sends messages.
author masca@cpw.pidgin.im
date Wed, 16 Jun 2010 21:32:12 +0000
parents e545b2b6f66a
children 37474bb06bad
files libpurple/protocols/msn/directconn.c libpurple/protocols/msn/directconn.h
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c	Wed Jun 16 21:25:11 2010 +0000
+++ b/libpurple/protocols/msn/directconn.c	Wed Jun 16 21:32:12 2010 +0000
@@ -557,6 +557,23 @@
 	msn_dc_enqueue_packet(dc, p);
 }
 
+void
+msn_dc_enqueue_part(MsnDirectConn *dc, MsnSlpMessagePart *part)
+{
+	MsnDirectConnPacket *p;
+	guint32 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->sent_cb = msn_dc_send_packet_cb;
+
+	msn_dc_enqueue_packet(dc, p);
+}
+
 static int
 msn_dc_process_packet(MsnDirectConn *dc, guint32 packet_length)
 {
--- a/libpurple/protocols/msn/directconn.h	Wed Jun 16 21:25:11 2010 +0000
+++ b/libpurple/protocols/msn/directconn.h	Wed Jun 16 21:32:12 2010 +0000
@@ -34,6 +34,7 @@
 #include "slp.h"
 #include "slplink.h"
 #include "slpmsg.h"
+#include "slpmsg_part.h"
 #include "p2p.h"
 
 #define MSN_DCCONN_MAX_SIZE 1352
@@ -129,6 +130,8 @@
  */
 void
 msn_dc_enqueue_msg(MsnDirectConn *dc, MsnMessage *msg);
+void
+msn_dc_enqueue_part(MsnDirectConn *dc, MsnSlpMessagePart *part);
 
 /*
  * Creates, initializes, and returns a new MsnDirectConn structure.