Mercurial > pidgin.yaz
changeset 31240:0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
author | masca@cpw.pidgin.im |
---|---|
date | Wed, 16 Jun 2010 22:17:28 +0000 |
parents | fd8abea40a0d |
children | 9a916d3ac643 |
files | libpurple/protocols/msn/slplink.c |
diffstat | 1 files changed, 22 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/slplink.c Wed Jun 16 22:12:07 2010 +0000 +++ b/libpurple/protocols/msn/slplink.c Wed Jun 16 22:17:28 2010 +0000 @@ -27,6 +27,7 @@ #include "msn.h" #include "slplink.h" +#include "slpmsg_part.h" #include "sbconn.h" #include "switchboard.h" @@ -266,6 +267,18 @@ } void +msn_slplink_send_part(MsnSlpLink *slplink, MsnSlpMessagePart *part) +{ + if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED) + { + msn_dc_enqueue_part(slplink->dc, part); + } + else + { + msn_sbconn_send_part(slplink, part); + } +} +void msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg) { if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED) @@ -281,13 +294,13 @@ void msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) { - MsnMessage *msg; + MsnSlpMessagePart *part; long long real_size; size_t len = 0; /* Maybe we will want to create a new msg for this slpmsg instead of * reusing the same one all the time. */ - msg = slpmsg->msg; + part = msn_slpmsgpart_new(slpmsg->header, slpmsg->footer); real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size; @@ -297,7 +310,7 @@ purple_xfer_get_status(slpmsg->slpcall->xfer) == PURPLE_XFER_STATUS_STARTED) { len = MIN(MSN_SBCONN_MAX_SIZE, slpmsg->slpcall->u.outgoing.len); - msn_message_set_bin_data(msg, slpmsg->slpcall->u.outgoing.data, len); + msn_slpmsgpart_set_bin_data(part, slpmsg->slpcall->u.outgoing.data, len); } else { @@ -306,23 +319,25 @@ if (len > MSN_SBCONN_MAX_SIZE) len = MSN_SBCONN_MAX_SIZE; - msn_message_set_bin_data(msg, slpmsg->buffer + slpmsg->offset, len); + msn_slpmsgpart_set_bin_data(part, slpmsg->slpcall->u.outgoing.data, len); } slpmsg->header->offset = slpmsg->offset; slpmsg->header->length = len; } +#if 0 + /* TODO: port this function to SlpMessageParts */ if (purple_debug_is_verbose()) msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body); +#endif #ifdef MSN_DEBUG_SLP_FILES debug_msg_to_file(msg, TRUE); #endif - slpmsg->msgs = - g_list_append(slpmsg->msgs, msn_message_ref(msg)); - msn_slplink_send_msg(slplink, msg); + slpmsg->parts = g_list_append(slpmsg->parts, part); + msn_slplink_send_part(slplink, part); if ((slpmsg->flags == P2P_MSN_OBJ_DATA || slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||