changeset 31236:37474bb06bad

Add support in SBConn to send parts instead of messages.
author masca@cpw.pidgin.im
date Wed, 16 Jun 2010 21:45:50 +0000
parents efe9b0338606
children cce127730270
files libpurple/protocols/msn/sbconn.c libpurple/protocols/msn/sbconn.h
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/sbconn.c	Wed Jun 16 21:32:12 2010 +0000
+++ b/libpurple/protocols/msn/sbconn.c	Wed Jun 16 21:45:50 2010 +0000
@@ -1,3 +1,6 @@
+#include "internal.h"
+
+#include "msg.h"
 #include "sbconn.h"
 
 /* We have received the message ack */
@@ -74,3 +77,30 @@
 
 	msn_switchboard_send_msg(slplink->swboard, msg, TRUE);
 }
+
+void msn_sbconn_send_part(MsnSlpLink *slplink, MsnSlpMessagePart *part)
+{
+	MsnMessage *msg;
+	char *data;
+	size_t size;
+
+	msg = msn_message_new_msnslp();
+
+	data = msn_slpmsgpart_serialize(part, &size);
+	msg->part = part;
+
+	msn_message_set_bin_data(msg, data, size);
+
+	if (slplink->swboard == NULL)
+	{
+		slplink->swboard = msn_session_get_swboard(slplink->session,
+				slplink->remote_user, MSN_SB_FLAG_FT);
+
+		g_return_if_fail(slplink->swboard != NULL);
+
+		/* If swboard is destroyed we will be too */
+		slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink);
+	}
+
+	msn_switchboard_send_msg(slplink->swboard, msg, TRUE);
+}
--- a/libpurple/protocols/msn/sbconn.h	Wed Jun 16 21:32:12 2010 +0000
+++ b/libpurple/protocols/msn/sbconn.h	Wed Jun 16 21:45:50 2010 +0000
@@ -11,5 +11,6 @@
 void msn_sbconn_msg_nak(MsnMessage *msg, void *data);
 
 void msn_sbconn_send_msg(MsnSlpLink *slplink, MsnMessage *msg);
+void msn_sbconn_send_part(MsnSlpLink *slplink, MsnSlpMessagePart *part);
 
 #endif /* MSN_SBCONN_H */