soc.2010.msn-tlc: 6601beab: Process SlpMessageParts, a sequence of p...
masca at cpw.pidgin.im
masca at cpw.pidgin.im
Thu Jul 29 21:37:04 EDT 2010
----------------------------------------------------------------------
Revision: 6601beab41218971580648c827ee68a1c02fb1ef
Parent: 2790841abc711888e2ff9dded08925f937a38f40
Author: masca at cpw.pidgin.im
Date: 07/28/10 20:12:54
Branch: im.pidgin.soc.2010.msn-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/6601beab41218971580648c827ee68a1c02fb1ef
Changelog:
Process SlpMessageParts, a sequence of parts will generate a SlpMessage.
Changes against parent 2790841abc711888e2ff9dded08925f937a38f40
patched libpurple/protocols/msn/directconn.c
patched libpurple/protocols/msn/msg.c
patched libpurple/protocols/msn/slplink.c
patched libpurple/protocols/msn/slplink.h
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msg.c 722c049914d84a9dcb77ce499aaee2c958fd2d4d
+++ libpurple/protocols/msn/msg.c c20c22dce7b2f670f4eb311dea3acc0ba8fd156e
@@ -943,10 +943,7 @@ msn_p2p_msg(MsnCmdProc *cmdproc, MsnMess
data = msn_message_get_bin_data(msg, &len);
if (msg->part) {
- len -= P2P_PACKET_HEADER_SIZE;
- len -= P2P_PACKET_FOOTER_SIZE;
-
- msn_slplink_process_msg(slplink, msg->part->header, data+P2P_PACKET_HEADER_SIZE, len);
+ msn_slplink_process_msg(slplink, msg->part);
}
else /* This should never happen. */
purple_debug_fatal("msn", "P2P message without a Part.\n");
============================================================
--- libpurple/protocols/msn/directconn.c f8d826e0a5ddea689ed03418d355b5eeb757c7c2
+++ libpurple/protocols/msn/directconn.c fc2fc4d86cad14c498cd114bb204dc4e6243bb91
@@ -591,6 +591,8 @@ msn_dc_process_packet(MsnDirectConn *dc,
static int
msn_dc_process_packet(MsnDirectConn *dc, guint32 packet_length)
{
+ MsnSlpMessagePart *part;
+
g_return_val_if_fail(dc != NULL, DC_PROCESS_ERROR);
switch (dc->state) {
@@ -627,13 +629,10 @@ msn_dc_process_packet(MsnDirectConn *dc,
break;
case DC_STATE_ESTABLISHED:
- msn_slplink_process_msg(
- dc->slplink,
- &dc->header,
- dc->in_buffer + 4 + P2P_PACKET_HEADER_SIZE,
- dc->header.length
- );
+ part = msn_slpmsgpart_new_from_data(dc->in_buffer, dc->header.length);
+ msn_slplink_process_msg(dc->slplink, part);
+
/*
if (dc->num_calls == 0) {
msn_dc_destroy(dc);
============================================================
--- libpurple/protocols/msn/slplink.c e865ab5a2a8158ef47798694eee2cef289aa34dd
+++ libpurple/protocols/msn/slplink.c 0ed77905d98035a7c7bfe13ccfbc0e92a6645d49
@@ -569,11 +569,14 @@ void
}
void
-msn_slplink_process_msg(MsnSlpLink *slplink, MsnP2PHeader *header, const char *data, gsize len)
+msn_slplink_process_msg(MsnSlpLink *slplink, MsnSlpMessagePart *part)
{
MsnSlpMessage *slpmsg;
+ MsnP2PHeader *header;
guint64 offset;
+ header = part->header;
+
if (header->total_size < header->length)
{
/* We seem to have received a bad header */
@@ -600,20 +603,22 @@ msn_slplink_process_msg(MsnSlpLink *slpl
if (slpmsg->ft)
{
slpmsg->slpcall->u.incoming_data =
- g_byte_array_append(slpmsg->slpcall->u.incoming_data, (const guchar *)data, len);
+ g_byte_array_append(slpmsg->slpcall->u.incoming_data, (const guchar *)part->buffer, part->size);
purple_xfer_prpl_ready(slpmsg->slpcall->xfer);
}
else if (slpmsg->size && slpmsg->buffer)
{
- if (G_MAXSIZE - len < offset || (offset + len) > slpmsg->size || slpmsg->offset != offset)
+ if (G_MAXSIZE - part->size < offset
+ || (offset + part->size) > slpmsg->size
+ || slpmsg->offset != offset)
{
purple_debug_error("msn",
"Oversized slpmsg - msgsize=%lld offset=%" G_GUINT64_FORMAT " len=%" G_GSIZE_FORMAT "\n",
- slpmsg->size, offset, len);
+ slpmsg->size, offset, part->size);
g_return_if_reached();
} else {
- memcpy(slpmsg->buffer + offset, data, len);
- slpmsg->offset += len;
+ memcpy(slpmsg->buffer + offset, part->buffer, part->size);
+ slpmsg->offset += part->size;
}
}
@@ -627,7 +632,7 @@ msn_slplink_process_msg(MsnSlpLink *slpl
if (slpmsg->slpcall->progress_cb != NULL)
{
slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size,
- len, offset);
+ part->size, offset);
}
}
============================================================
--- libpurple/protocols/msn/slplink.h 7d07dc4e5819bb8b26dc7449eb92deb67f67a442
+++ libpurple/protocols/msn/slplink.h 16fc408891645426e2ea4970f79487fee0d44744
@@ -79,7 +79,7 @@ void msn_slplink_send_queued_slpmsgs(Msn
void msn_slplink_send_slpmsg(MsnSlpLink *slplink,
MsnSlpMessage *slpmsg);
void msn_slplink_send_queued_slpmsgs(MsnSlpLink *slplink);
-void msn_slplink_process_msg(MsnSlpLink *slplink, MsnP2PHeader *header, const char *data, gsize len);
+void msn_slplink_process_msg(MsnSlpLink *slplink, MsnSlpMessagePart *part);
/* Only exported for msn_xfer_write */
void msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg);
More information about the Commits
mailing list