changeset 30790:545fa069c531

The creation of SlpMessage must be done in its own module.
author masca@cpw.pidgin.im
date Thu, 10 Jun 2010 22:40:44 +0000
parents 2c3d7104ef1e
children 64a6ce55aa63
files libpurple/protocols/msn/slplink.c libpurple/protocols/msn/slpmsg.c libpurple/protocols/msn/slpmsg.h
diffstat 3 files changed, 28 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slplink.c	Thu Jun 10 22:17:26 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Thu Jun 10 22:40:44 2010 +0000
@@ -505,15 +505,8 @@
 {
 	MsnSlpMessage *slpmsg;
 
-	slpmsg = msn_slpmsg_new(slplink);
-
-	slpmsg->session_id = header->session_id;
-	slpmsg->size       = header->total_size;
-	slpmsg->flags      = P2P_ACK;
-	slpmsg->ack_id     = header->id;
-	slpmsg->ack_sub_id = header->ack_id;
-	slpmsg->ack_size   = header->total_size;
-	slpmsg->info = "SLP ACK";
+	slpmsg = msn_slpmsg_new_ack(header);
+	msn_slpmsg_set_slplink(slpmsg, slplink);
 
 	return slpmsg;
 }
--- a/libpurple/protocols/msn/slpmsg.c	Thu Jun 10 22:17:26 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg.c	Thu Jun 10 22:40:44 2010 +0000
@@ -263,6 +263,23 @@
 	return slpmsg;
 }
 
+MsnSlpMessage *msn_slpmsg_new_ack(MsnP2PHeader *header)
+{
+	MsnSlpMessage *slpmsg;
+
+	slpmsg = msn_slpmsg_new(NULL);
+
+	slpmsg->session_id = header->session_id;
+	slpmsg->size       = header->total_size;
+	slpmsg->flags      = P2P_ACK;
+	slpmsg->ack_id     = header->id;
+	slpmsg->ack_sub_id = header->ack_id;
+	slpmsg->ack_size   = header->total_size;
+	slpmsg->info = "SLP ACK";
+
+	return slpmsg;
+}
+
 char *msn_slpmsg_serialize(MsnSlpMessage *slpmsg, size_t *ret_size)
 {
 	MsnP2PHeader *header;
--- a/libpurple/protocols/msn/slpmsg.h	Thu Jun 10 22:17:26 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg.h	Thu Jun 10 22:40:44 2010 +0000
@@ -129,6 +129,15 @@
 								   const char *content_type,
 								   const char *content);
 
+/**
+ * Create a new SLP Ack message
+ *
+ * @param header the value of the header in this slpmsg.
+ *
+ * @return A new SlpMessage with ACK headers
+ */
+MsnSlpMessage *msn_slpmsg_new_ack(MsnP2PHeader *header);
+
 void msn_slpmsg_show(MsnMessage *msg);
 
 /**