Mercurial > pidgin.yaz
changeset 31217:23b7b1b817c8
merge of '5af6a35c4c39341b79cc8d61c700da2b874b9b6b'
and 'b4a877b5d355860851acfe7ac186ba5d4f88d684'
author | masca@cpw.pidgin.im |
---|---|
date | Sun, 06 Jun 2010 21:27:12 +0000 |
parents | acc66653b4ff (current diff) 432e3331f607 (diff) |
children | b98d1ca8422d |
files | libpurple/protocols/msn/directconn.c libpurple/protocols/msn/directconn.h libpurple/protocols/msn/slp.c libpurple/protocols/msn/slplink.c |
diffstat | 12 files changed, 197 insertions(+), 197 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/Makefile.am Wed Jun 02 20:51:24 2010 +0000 +++ b/libpurple/protocols/msn/Makefile.am Sun Jun 06 21:27:12 2010 +0000 @@ -34,6 +34,8 @@ object.h \ oim.c\ oim.h\ + p2p.c \ + p2p.h \ page.c \ page.h \ servconn.c \
--- a/libpurple/protocols/msn/Makefile.mingw Wed Jun 02 20:51:24 2010 +0000 +++ b/libpurple/protocols/msn/Makefile.mingw Sun Jun 06 21:27:12 2010 +0000 @@ -52,6 +52,7 @@ notification.c \ object.c \ oim.c\ + p2p.c \ page.c \ servconn.c \ session.c \
--- a/libpurple/protocols/msn/directconn.c Wed Jun 02 20:51:24 2010 +0000 +++ b/libpurple/protocols/msn/directconn.c Sun Jun 06 21:27:12 2010 +0000 @@ -31,25 +31,10 @@ #include "slp.h" #include "slpmsg.h" +#include "p2p.h" -#pragma pack(push,1) -typedef struct { - guint32 session_id; - guint32 seq_id; - guint64 offset; - guint64 total_size; - guint32 length; - guint32 flags; - guint32 ack_id; - guint32 ack_uid; - guint64 ack_size; -/* guint8 body[1]; */ -} MsnDcContext; -#pragma pack(pop) - -#define DC_PACKET_HEADER_SIZE sizeof(MsnDcContext) #define DC_MAX_BODY_SIZE 8*1024 -#define DC_MAX_PACKET_SIZE (DC_PACKET_HEADER_SIZE + DC_MAX_BODY_SIZE) +#define DC_MAX_PACKET_SIZE (P2P_PACKET_HEADER_SIZE + DC_MAX_BODY_SIZE) static void msn_dc_calculate_nonce_hash(MsnDirectConnNonceType type, @@ -368,51 +353,6 @@ } static void -msn_dc_parse_binary_header(MsnDirectConn *dc) -{ - MsnSlpHeader *h; - MsnDcContext *context; - - g_return_if_fail(dc != NULL); - - h = &dc->header; - /* Skip packet size */ - context = (MsnDcContext *)(dc->in_buffer + 4); - - h->session_id = GUINT32_FROM_LE(context->session_id); - h->id = GUINT32_FROM_LE(context->seq_id); - h->offset = GUINT64_FROM_LE(context->offset); - h->total_size = GUINT64_FROM_LE(context->total_size); - h->length = GUINT32_FROM_LE(context->length); - h->flags = GUINT32_FROM_LE(context->flags); - h->ack_id = GUINT32_FROM_LE(context->ack_id); - h->ack_sub_id = GUINT32_FROM_LE(context->ack_uid); - h->ack_size = GUINT64_FROM_LE(context->ack_size); -} - -static const gchar * -msn_dc_serialize_binary_header(MsnDirectConn *dc) { - MsnSlpHeader *h; - static MsnDcContext bin_header; - - g_return_val_if_fail(dc != NULL, NULL); - - h = &dc->header; - - bin_header.session_id = GUINT32_TO_LE(h->session_id); - bin_header.seq_id = GUINT32_TO_LE(h->id); - bin_header.offset = GUINT64_TO_LE(h->offset); - bin_header.total_size = GUINT64_TO_LE(h->total_size); - bin_header.length = GUINT32_TO_LE(h->length); - bin_header.flags = GUINT32_TO_LE(h->flags); - bin_header.ack_id = GUINT32_TO_LE(h->ack_id); - bin_header.ack_uid = GUINT32_TO_LE(h->ack_sub_id); - bin_header.ack_size = GUINT64_TO_LE(h->ack_size); - - return (const gchar *)&bin_header; -} - -static void msn_dc_send_cb(gpointer data, gint fd, PurpleInputCondition cond) { MsnDirectConn *dc = data; @@ -507,10 +447,11 @@ { const gchar *h; - h = msn_dc_serialize_binary_header(dc); - memcpy(p->data, h, DC_PACKET_HEADER_SIZE); + h = (gchar*) msn_p2p_header_to_wire(&dc->header); - memcpy(p->data + offsetof(MsnDcContext, ack_id), dc->nonce, 16); + memcpy(p->data, h, P2P_PACKET_HEADER_SIZE); + + memcpy(p->data + offsetof(MsnP2PHeader, ack_id), dc->nonce, 16); msn_dc_enqueue_packet(dc, p); } @@ -520,7 +461,7 @@ { MsnDirectConnPacket *p; - p = msn_dc_new_packet(DC_PACKET_HEADER_SIZE); + p = msn_dc_new_packet(P2P_PACKET_HEADER_SIZE); dc->header.session_id = 0; dc->header.id = dc->slpcall->slplink->slp_seq_id++; @@ -537,7 +478,7 @@ { MsnDirectConnPacket *p; - p = msn_dc_new_packet(DC_PACKET_HEADER_SIZE); + p = msn_dc_new_packet(P2P_PACKET_HEADER_SIZE); dc->header.id = dc->slpcall->slplink->slp_seq_id++; dc->header.length = 0; @@ -551,10 +492,10 @@ guchar nonce[16]; gchar nonce_hash[37]; - if (packet_length != DC_PACKET_HEADER_SIZE) + if (packet_length != P2P_PACKET_HEADER_SIZE) return FALSE; - memcpy(nonce, dc->in_buffer + 4 + offsetof(MsnDcContext, ack_id), 16); + memcpy(nonce, dc->in_buffer + 4 + offsetof(MsnP2PHeader, ack_id), 16); if (dc->nonce_type == DC_NONCE_PLAIN) { if (memcmp(dc->nonce, nonce, 16) == 0) { @@ -604,11 +545,11 @@ MsnDirectConnPacket *p; guint32 length; - length = msg->body_len + DC_PACKET_HEADER_SIZE; + length = msg->body_len + P2P_PACKET_HEADER_SIZE; p = msn_dc_new_packet(length); - memcpy(p->data, &msg->msnslp_header, DC_PACKET_HEADER_SIZE); - memcpy(p->data + DC_PACKET_HEADER_SIZE, msg->body, msg->body_len); + memcpy(p->data, &msg->msnslp_header, P2P_PACKET_HEADER_SIZE); + memcpy(p->data + P2P_PACKET_HEADER_SIZE, msg->body, msg->body_len); p->sent_cb = msn_dc_send_packet_cb; p->msg = msn_message_ref(msg); @@ -658,7 +599,7 @@ msn_slplink_process_msg( dc->slplink, &dc->header, - dc->in_buffer + 4 + DC_PACKET_HEADER_SIZE, + dc->in_buffer + 4 + P2P_PACKET_HEADER_SIZE, dc->header.length ); @@ -732,7 +673,15 @@ return; if (dc->state != DC_STATE_FOO) { - msn_dc_parse_binary_header(dc); + MsnP2PHeader *context; + MsnP2PHeader *h; + + /* Skip packet size */ + context = (MsnP2PHeader *)(dc->in_buffer + 4); + + h = msn_p2p_header_from_wire(context); + memcpy(&dc->header, h, P2P_PACKET_HEADER_SIZE); + g_free(h); } switch (msn_dc_process_packet(dc, packet_length)) {
--- a/libpurple/protocols/msn/directconn.h Wed Jun 02 20:51:24 2010 +0000 +++ b/libpurple/protocols/msn/directconn.h Sun Jun 06 21:27:12 2010 +0000 @@ -34,6 +34,7 @@ #include "slp.h" #include "slplink.h" #include "slpmsg.h" +#include "p2p.h" typedef enum { @@ -100,7 +101,7 @@ GQueue *out_queue; /**< The outgoing packet queue */ int msg_pos; /**< The position of next byte to be sent in the actual packet */ - MsnSlpHeader header; /**< SLP header for parsing / serializing */ + MsnP2PHeader header; /**< SLP header for parsing / serializing */ /** The callback used for sending information to the peer about the opened socket */ void (*send_connection_info_msg_cb)(MsnDirectConn *);
--- a/libpurple/protocols/msn/msg.c Wed Jun 02 20:51:24 2010 +0000 +++ b/libpurple/protocols/msn/msg.c Sun Jun 06 21:27:12 2010 +0000 @@ -28,6 +28,7 @@ #include "msn.h" #include "msg.h" #include "msnutils.h" +#include "p2p.h" MsnMessage * msn_message_new(MsnMsgType type) @@ -163,29 +164,26 @@ void msn_message_parse_slp_body(MsnMessage *msg, const char *body, size_t len) { - MsnSlpHeader header; + MsnP2PHeader *header; + MsnP2PHeader wire; const char *tmp; int body_len; tmp = body; - if (len < sizeof(header)) { + if (len < sizeof(wire)) { g_return_if_reached(); } /* Extract the binary SLP header */ - memcpy(&header, tmp, sizeof(header)); - tmp += sizeof(header); + memcpy(&wire, tmp, sizeof(wire)); + tmp += sizeof(wire); - msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); - msg->msnslp_header.id = GUINT32_FROM_LE(header.id); - msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); - msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); - msg->msnslp_header.length = GUINT32_FROM_LE(header.length); - msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); - msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); - msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); - msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); + header = msn_p2p_header_from_wire(&wire); + + memcpy(&msg->msnslp_header, (char*)header, sizeof(*header)); + + g_free(header); /* Extract the body */ body_len = len - (tmp - body); @@ -298,8 +296,9 @@ if (content_type != NULL && !strcmp(content_type, "application/x-msnmsgrp2p")) { - MsnSlpHeader header; - MsnSlpFooter footer; + MsnP2PHeader *header; + MsnP2PHeader wire; + MsnP2PFooter footer; int body_len; if (payload_len - (tmp - tmp_base) < sizeof(header)) { @@ -310,18 +309,14 @@ msg->msnslp_message = TRUE; /* Extract the binary SLP header */ - memcpy(&header, tmp, sizeof(header)); - tmp += sizeof(header); + memcpy(&wire, tmp, sizeof(wire)); + tmp += sizeof(wire); - msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); - msg->msnslp_header.id = GUINT32_FROM_LE(header.id); - msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); - msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); - msg->msnslp_header.length = GUINT32_FROM_LE(header.length); - msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); - msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); - msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); - msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); + header = msn_p2p_header_from_wire(&wire); + + memcpy(&msg->msnslp_header, (char*)header, sizeof(*header)); + + g_free(header); body_len = payload_len - (tmp - tmp_base) - sizeof(footer); @@ -384,7 +379,7 @@ char * msn_message_gen_slp_body(MsnMessage *msg, size_t *ret_size) { - MsnSlpHeader header; + MsnP2PHeader *header; char *tmp, *base; const void *body; @@ -398,19 +393,13 @@ body = msn_message_get_bin_data(msg, &body_len); - header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); - header.id = GUINT32_TO_LE(msg->msnslp_header.id); - header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); - header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); - header.length = GUINT32_TO_LE(msg->msnslp_header.length); - header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); - header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); - header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); - header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); + header = msn_p2p_header_to_wire(&(msg->msnslp_header)); - memcpy(tmp, &header, 48); + memcpy(tmp, header, 48); tmp += 48; + g_free(header); + if (body != NULL) { memcpy(tmp, body, body_len); @@ -475,21 +464,15 @@ if (msg->msnslp_message) { - MsnSlpHeader header; - MsnSlpFooter footer; + MsnP2PHeader *header; + MsnP2PFooter footer; + + header = msn_p2p_header_to_wire(&(msg->msnslp_header)); - header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); - header.id = GUINT32_TO_LE(msg->msnslp_header.id); - header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); - header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); - header.length = GUINT32_TO_LE(msg->msnslp_header.length); - header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); - header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); - header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); - header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); + memcpy(n, header, 48); + n += 48; - memcpy(n, &header, 48); - n += 48; + g_free(header); if (body != NULL) {
--- a/libpurple/protocols/msn/msg.h Wed Jun 02 20:51:24 2010 +0000 +++ b/libpurple/protocols/msn/msg.h Sun Jun 06 21:27:12 2010 +0000 @@ -58,6 +58,7 @@ #include "session.h" #include "transaction.h" #include "user.h" +#include "p2p.h" typedef void (*MsnMsgCb)(MsnMessage *, void *data); @@ -67,41 +68,6 @@ #define MSG_OIM_BODY_DEM "\n\n" #define MSG_OIM_LINE_DEM "\n" -typedef enum -{ - SLP_HF_NO_FLAG = 0x0, /**< No flags specified */ - SLP_HF_OUT_OF_ORDER = 0x1, /**< Chunk out-of-order */ - SLP_HF_ACK = 0x2, /**< Acknowledgement */ - SLP_HF_PENDING_INVITE = 0x4, /**< There is a pending invite */ - SLP_HF_BINARY_ERROR = 0x8, /**< Error on the binary level */ - SLP_HF_MSN_OBJ_DATA = 0x20, /**< MsnObject data */ - SLP_HF_WML2009_COMP = 0x1000000, /**< Compatibility with WLM 2009 */ - SLP_HF_FILE_DATA = 0x1000030 /**< File transfer data */ -} SlpHeaderFlag; -/* Info From: - * http://msnpiki.msnfanatic.com/index.php/MSNC:P2Pv1_Headers#Flags - * http://trac.kmess.org/changeset/ba04d0c825769d23370511031c47f6be75fe9b86 - * #7180 - */ - -typedef struct -{ - guint32 session_id; - guint32 id; - guint64 offset; - guint64 total_size; - guint32 length; - guint32 flags; - guint32 ack_id; - guint32 ack_sub_id; - guint64 ack_size; -} MsnSlpHeader; - -typedef struct -{ - guint32 value; -} MsnSlpFooter; - /** * A message. */ @@ -123,8 +89,8 @@ guint total_chunks; /**< How many chunks in this multi-part message */ guint received_chunks; /**< How many chunks we've received so far */ - MsnSlpHeader msnslp_header; - MsnSlpFooter msnslp_footer; + MsnP2PHeader msnslp_header; + MsnP2PFooter msnslp_footer; GHashTable *header_table; GList *header_list;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libpurple/protocols/msn/p2p.c Sun Jun 06 21:27:12 2010 +0000 @@ -0,0 +1,45 @@ +#include "internal.h" + +#include "p2p.h" + +MsnP2PHeader * +msn_p2p_header_from_wire(MsnP2PHeader *wire) +{ + MsnP2PHeader *header; + + header = g_new(MsnP2PHeader, 1); + + header->session_id = GUINT32_FROM_LE(wire->session_id); + header->id = GUINT32_FROM_LE(wire->id); + header->offset = GUINT64_FROM_LE(wire->offset); + header->total_size = GUINT64_FROM_LE(wire->total_size); + header->length = GUINT32_FROM_LE(wire->length); + header->flags = GUINT32_FROM_LE(wire->flags); + header->ack_id = GUINT32_FROM_LE(wire->ack_id); + header->ack_sub_id = GUINT32_FROM_LE(wire->ack_sub_id); + header->ack_size = GUINT64_FROM_LE(wire->ack_size); + + return header; +} + +MsnP2PHeader * +msn_p2p_header_to_wire(MsnP2PHeader *header) +{ + MsnP2PHeader *wire; + + wire = g_new(MsnP2PHeader, 1); + + wire->session_id = GUINT32_TO_LE(header->session_id); + wire->id = GUINT32_TO_LE(header->id); + wire->offset = GUINT64_TO_LE(header->offset); + wire->total_size = GUINT64_TO_LE(header->total_size); + wire->length = GUINT32_TO_LE(header->length); + wire->flags = GUINT32_TO_LE(header->flags); + wire->ack_id = GUINT32_TO_LE(header->ack_id); + wire->ack_sub_id = GUINT32_TO_LE(header->ack_sub_id); + wire->ack_size = GUINT64_TO_LE(header->ack_size); + + return wire; + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libpurple/protocols/msn/p2p.h Sun Jun 06 21:27:12 2010 +0000 @@ -0,0 +1,50 @@ +#ifndef MSN_P2P_H +#define MSN_P2P_H + + +#pragma pack(push,1) +typedef struct { + guint32 session_id; + guint32 id; + guint64 offset; + guint64 total_size; + guint32 length; + guint32 flags; + guint32 ack_id; + guint32 ack_sub_id; + guint64 ack_size; +/* guint8 body[1]; */ +} MsnP2PHeader; +#pragma pack(pop) + +typedef struct +{ + guint32 value; +} MsnP2PFooter; + +typedef enum +{ + P2P_NO_FLAG = 0x0, /**< No flags specified */ + P2P_OUT_OF_ORDER = 0x1, /**< Chunk out-of-order */ + P2P_ACK = 0x2, /**< Acknowledgement */ + P2P_PENDING_INVITE = 0x4, /**< There is a pending invite */ + P2P_BINARY_ERROR = 0x8, /**< Error on the binary level */ + P2P_MSN_OBJ_DATA = 0x20, /**< MsnObject data */ + P2P_WML2009_COMP = 0x1000000, /**< Compatibility with WLM 2009 */ + P2P_FILE_DATA = 0x1000030 /**< File transfer data */ +} MsnP2PHeaderFlag; +/* Info From: + * http://msnpiki.msnfanatic.com/index.php/MSNC:P2Pv1_Headers#Flags + * http://trac.kmess.org/changeset/ba04d0c825769d23370511031c47f6be75fe9b86 + * #7180 + */ + +#define P2P_PACKET_HEADER_SIZE sizeof(MsnP2PHeader) + +MsnP2PHeader * +msn_p2p_header_from_wire(MsnP2PHeader *wire); + +MsnP2PHeader * +msn_p2p_header_to_wire(MsnP2PHeader *header); + +#endif /* MSN_P2P_H */
--- a/libpurple/protocols/msn/slp.c Wed Jun 02 20:51:24 2010 +0000 +++ b/libpurple/protocols/msn/slp.c Sun Jun 06 21:27:12 2010 +0000 @@ -34,6 +34,7 @@ #include "user.h" #include "switchboard.h" #include "directconn.h" +#include "p2p.h" #include "smiley.h" @@ -518,7 +519,7 @@ /* DATA */ slpmsg = msn_slpmsg_new(slplink); slpmsg->slpcall = slpcall; - slpmsg->flags = SLP_HF_MSN_OBJ_DATA; + slpmsg->flags = P2P_MSN_OBJ_DATA; slpmsg->info = "SLP DATA"; msn_slpmsg_set_image(slpmsg, img); msn_slplink_queue_slpmsg(slplink, slpmsg);
--- a/libpurple/protocols/msn/slpcall.c Wed Jun 02 20:51:24 2010 +0000 +++ b/libpurple/protocols/msn/slpcall.c Sun Jun 06 21:27:12 2010 +0000 @@ -29,6 +29,7 @@ #include "slpcall.h" #include "slp.h" +#include "p2p.h" /************************************************************************** * Main @@ -204,7 +205,7 @@ body = slpmsg->buffer; body_len = slpmsg->offset; - if (slpmsg->flags == SLP_HF_NO_FLAG || slpmsg->flags == SLP_HF_WML2009_COMP) + if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP) { char *body_str; @@ -265,9 +266,9 @@ } g_free(body_str); } - else if (slpmsg->flags == SLP_HF_MSN_OBJ_DATA || - slpmsg->flags == SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA || - slpmsg->flags == SLP_HF_FILE_DATA) + else if (slpmsg->flags == P2P_MSN_OBJ_DATA || + slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || + slpmsg->flags == P2P_FILE_DATA) { slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); @@ -293,7 +294,7 @@ msn_slpcall_session_init(slpcall); } #endif - else if (slpmsg->flags == SLP_HF_ACK) + else if (slpmsg->flags == P2P_ACK) { /* Acknowledgement of previous message. Don't do anything currently. */ }
--- a/libpurple/protocols/msn/slplink.c Wed Jun 02 20:51:24 2010 +0000 +++ b/libpurple/protocols/msn/slplink.c Sun Jun 06 21:27:12 2010 +0000 @@ -30,6 +30,7 @@ #include "switchboard.h" #include "slp.h" +#include "p2p.h" #ifdef MSN_DEBUG_SLP_FILES static int m_sc = 0; @@ -298,7 +299,7 @@ * reusing the same one all the time. */ msg = slpmsg->msg; - real_size = (slpmsg->flags == SLP_HF_ACK) ? 0 : slpmsg->size; + real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size; if (slpmsg->offset < real_size) { @@ -333,9 +334,9 @@ g_list_append(slpmsg->msgs, msn_message_ref(msg)); msn_slplink_send_msg(slplink, msg); - if ((slpmsg->flags == SLP_HF_MSN_OBJ_DATA || - slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || - slpmsg->flags == SLP_HF_FILE_DATA) && + if ((slpmsg->flags == P2P_MSN_OBJ_DATA || + slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || + slpmsg->flags == P2P_FILE_DATA) && (slpmsg->slpcall != NULL)) { slpmsg->slpcall->progress = TRUE; @@ -359,7 +360,7 @@ slpmsg = data; - real_size = (slpmsg->flags == SLP_HF_ACK) ? 0 : slpmsg->size; + real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size; slpmsg->offset += msg->msnslp_header.length; @@ -379,9 +380,9 @@ else { /* The whole message has been sent */ - if (slpmsg->flags == SLP_HF_MSN_OBJ_DATA || - slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || - slpmsg->flags == SLP_HF_FILE_DATA) + if (slpmsg->flags == P2P_MSN_OBJ_DATA || + slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || + slpmsg->flags == P2P_FILE_DATA) { if (slpmsg->slpcall != NULL) { @@ -417,21 +418,21 @@ slpmsg->msg = msg = msn_message_new_msnslp(); - if (slpmsg->flags == SLP_HF_NO_FLAG) + if (slpmsg->flags == P2P_NO_FLAG) { msg->msnslp_header.session_id = slpmsg->session_id; msg->msnslp_header.ack_id = rand() % 0xFFFFFF00; } - else if (slpmsg->flags == SLP_HF_ACK) + else if (slpmsg->flags == P2P_ACK) { msg->msnslp_header.session_id = slpmsg->session_id; msg->msnslp_header.ack_id = slpmsg->ack_id; msg->msnslp_header.ack_size = slpmsg->ack_size; msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id; } - else if (slpmsg->flags == SLP_HF_MSN_OBJ_DATA || - slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || - slpmsg->flags == SLP_HF_FILE_DATA) + else if (slpmsg->flags == P2P_MSN_OBJ_DATA || + slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || + slpmsg->flags == P2P_FILE_DATA) { MsnSlpCall *slpcall; slpcall = slpmsg->slpcall; @@ -496,7 +497,7 @@ } static MsnSlpMessage * -msn_slplink_create_ack(MsnSlpLink *slplink, MsnSlpHeader *header) +msn_slplink_create_ack(MsnSlpLink *slplink, MsnP2PHeader *header) { MsnSlpMessage *slpmsg; @@ -504,7 +505,7 @@ slpmsg->session_id = header->session_id; slpmsg->size = header->total_size; - slpmsg->flags = SLP_HF_ACK; + slpmsg->flags = P2P_ACK; slpmsg->ack_id = header->id; slpmsg->ack_sub_id = header->ack_id; slpmsg->ack_size = header->total_size; @@ -514,7 +515,7 @@ } static void -msn_slplink_send_ack(MsnSlpLink *slplink, MsnSlpHeader *header) +msn_slplink_send_ack(MsnSlpLink *slplink, MsnP2PHeader *header) { MsnSlpMessage *slpmsg = msn_slplink_create_ack(slplink, header); @@ -542,7 +543,7 @@ slpmsg = msn_slpmsg_new(slpcall->slplink); slpmsg->slpcall = slpcall; - slpmsg->flags = SLP_HF_FILE_DATA; + slpmsg->flags = P2P_FILE_DATA; slpmsg->info = "SLP FILE"; slpmsg->size = purple_xfer_get_size(xfer); @@ -566,7 +567,7 @@ } void -msn_slplink_process_msg(MsnSlpLink *slplink, MsnSlpHeader *header, const char *data, gsize len) +msn_slplink_process_msg(MsnSlpLink *slplink, MsnP2PHeader *header, const char *data, gsize len) { MsnSlpMessage *slpmsg; guint64 offset; @@ -595,9 +596,9 @@ slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); if (slpmsg->slpcall != NULL) { - if (slpmsg->flags == SLP_HF_MSN_OBJ_DATA || - slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || - slpmsg->flags == SLP_HF_FILE_DATA) + if (slpmsg->flags == P2P_MSN_OBJ_DATA || + slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || + slpmsg->flags == P2P_FILE_DATA) { PurpleXfer *xfer = slpmsg->slpcall->xfer; if (xfer != NULL) @@ -661,9 +662,9 @@ } } - if ((slpmsg->flags == SLP_HF_MSN_OBJ_DATA || - slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || - slpmsg->flags == SLP_HF_FILE_DATA) && + if ((slpmsg->flags == P2P_MSN_OBJ_DATA || + slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || + slpmsg->flags == P2P_FILE_DATA) && (slpmsg->slpcall != NULL)) { slpmsg->slpcall->progress = TRUE; @@ -704,10 +705,10 @@ msn_directconn_send_handshake(directconn); #endif } - else if (slpmsg->flags == SLP_HF_NO_FLAG || slpmsg->flags == SLP_HF_WML2009_COMP || - slpmsg->flags == SLP_HF_MSN_OBJ_DATA || - slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || - slpmsg->flags == SLP_HF_FILE_DATA) + else if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP || + slpmsg->flags == P2P_MSN_OBJ_DATA || + slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || + slpmsg->flags == P2P_FILE_DATA) { /* Release all the messages and send the ACK */
--- a/libpurple/protocols/msn/slplink.h Wed Jun 02 20:51:24 2010 +0000 +++ b/libpurple/protocols/msn/slplink.h Sun Jun 06 21:27:12 2010 +0000 @@ -81,7 +81,7 @@ void msn_slplink_send_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); void msn_slplink_send_queued_slpmsgs(MsnSlpLink *slplink); -void msn_slplink_process_msg(MsnSlpLink *slplink, MsnSlpHeader *header, const char *data, gsize len); +void msn_slplink_process_msg(MsnSlpLink *slplink, MsnP2PHeader *header, const char *data, gsize len); void msn_slplink_request_ft(MsnSlpLink *slplink, PurpleXfer *xfer); void msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg);