# HG changeset patch # User masca@cpw.pidgin.im # Date 1276209644 0 # Node ID 545fa069c531b48b53830de8856479dc4634185c # Parent 2c3d7104ef1e21e2ff3df9258057cbcb5352e0b0 The creation of SlpMessage must be done in its own module. diff -r 2c3d7104ef1e -r 545fa069c531 libpurple/protocols/msn/slplink.c --- 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; } diff -r 2c3d7104ef1e -r 545fa069c531 libpurple/protocols/msn/slpmsg.c --- 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; diff -r 2c3d7104ef1e -r 545fa069c531 libpurple/protocols/msn/slpmsg.h --- 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); /**