# HG changeset patch # User Mark Doliner # Date 1250130295 0 # Node ID e0dc076ba642897c5fcff3a253b06aff7fd55bb8 # Parent 3ba807e0d06621d54bda7e06c86bd022e29f2d2f# Parent 782dffe2cf2dabe0bcceddf8d50014499ca5771d merge of '156e8a2f721f092d3fd2044315094a886b637ecd' and '76b9820ced8976f78942e239a553ed008b0551bc' diff -r 3ba807e0d066 -r e0dc076ba642 libpurple/protocols/msn/cmdproc.c --- a/libpurple/protocols/msn/cmdproc.c Thu Aug 13 01:17:05 2009 +0000 +++ b/libpurple/protocols/msn/cmdproc.c Thu Aug 13 02:24:55 2009 +0000 @@ -337,30 +337,19 @@ { if (trans != NULL) { - MsnErrorCb error_cb = NULL; + MsnErrorCb error_cb; int error; error = atoi(cmd->command); - if (trans->error_cb != NULL) - error_cb = trans->error_cb; - - if (error_cb == NULL && cmdproc->cbs_table->errors != NULL) + error_cb = trans->error_cb; + if (error_cb == NULL) error_cb = g_hash_table_lookup(cmdproc->cbs_table->errors, trans->command); if (error_cb != NULL) - { error_cb(cmdproc, trans, error); - } else - { -#if 1 msn_error_handle(cmdproc->session, error); -#else - purple_debug_warning("msn", "Unhandled error '%s'\n", - cmd->command); -#endif - } return; } diff -r 3ba807e0d066 -r e0dc076ba642 libpurple/protocols/msn/directconn.c --- a/libpurple/protocols/msn/directconn.c Thu Aug 13 01:17:05 2009 +0000 +++ b/libpurple/protocols/msn/directconn.c Thu Aug 13 02:24:55 2009 +0000 @@ -247,14 +247,6 @@ } static void -msn_directconn_process_msg(MsnDirectConn *directconn, MsnMessage *msg) -{ - purple_debug_info("msn", "directconn: process_msg\n"); - - msn_slplink_process_msg(directconn->slplink, msg); -} - -static void read_cb(gpointer data, gint source, PurpleInputCondition cond) { MsnDirectConn* directconn; @@ -267,6 +259,19 @@ directconn = data; /* Let's read the length of the data. */ +#error This code is broken. See the note below. + /* + * TODO: This has problems! First of all, sizeof(body_len) will be + * different on 32bit systems and on 64bit systems (4 bytes + * vs. 8 bytes). + * Secondly, we're reading from a TCP stream. There is no + * guarantee that we have received the number of bytes we're + * trying to read. We need to read into a buffer. If read + * returns <0 then we need to check errno. If errno is EAGAIN + * then don't destroy anything, just exit and wait for more + * data. See every other function in libpurple that does this + * correctly for an example. + */ len = read(directconn->fd, &body_len, sizeof(body_len)); if (len <= 0) @@ -337,7 +342,8 @@ msg = msn_message_new_msnslp(); msn_message_parse_slp_body(msg, body, body_len); - msn_directconn_process_msg(directconn, msg); + purple_debug_info("msn", "directconn: process_msg\n"); + msn_slplink_process_msg(directconn->slplink, msg); } else { diff -r 3ba807e0d066 -r e0dc076ba642 libpurple/protocols/msn/session.h --- a/libpurple/protocols/msn/session.h Thu Aug 13 01:17:05 2009 +0000 +++ b/libpurple/protocols/msn/session.h Thu Aug 13 02:24:55 2009 +0000 @@ -35,7 +35,6 @@ #include "switchboard.h" #include "group.h" -#include "cmdproc.h" #include "nexus.h" #include "httpconn.h" #include "oim.h" diff -r 3ba807e0d066 -r e0dc076ba642 libpurple/protocols/msn/slpmsg.h --- a/libpurple/protocols/msn/slpmsg.h Thu Aug 13 01:17:05 2009 +0000 +++ b/libpurple/protocols/msn/slpmsg.h Thu Aug 13 02:24:55 2009 +0000 @@ -50,10 +50,8 @@ long ack_id; long ack_sub_id; long long ack_size; - long app_id; gboolean sip; /**< A flag that states if this is a SIP slp message. */ - int ref_count; /**< The reference count. */ long flags; FILE *fp; diff -r 3ba807e0d066 -r e0dc076ba642 libpurple/protocols/msn/sync.h --- a/libpurple/protocols/msn/sync.h Thu Aug 13 01:17:05 2009 +0000 +++ b/libpurple/protocols/msn/sync.h Thu Aug 13 02:24:55 2009 +0000 @@ -34,6 +34,11 @@ { MsnSession *session; MsnTable *cbs_table; + + /* + * TODO: What is the intended purpose of old_cbs_table? Nothing + * sets it and it is only read in two places. + */ MsnTable *old_cbs_table; int num_users; diff -r 3ba807e0d066 -r e0dc076ba642 libpurple/protocols/msn/userlist.h --- a/libpurple/protocols/msn/userlist.h Thu Aug 13 01:17:05 2009 +0000 +++ b/libpurple/protocols/msn/userlist.h Thu Aug 13 02:24:55 2009 +0000 @@ -26,7 +26,6 @@ typedef struct _MsnUserList MsnUserList; -#include "cmdproc.h" #include "user.h" #include "group.h"