Mercurial > pidgin
changeset 27897:e0dc076ba642
merge of '156e8a2f721f092d3fd2044315094a886b637ecd'
and '76b9820ced8976f78942e239a553ed008b0551bc'
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 13 Aug 2009 02:24:55 +0000 |
parents | 3ba807e0d066 (current diff) 782dffe2cf2d (diff) |
children | 28485b9ea656 |
files | |
diffstat | 6 files changed, 23 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- 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; }
--- 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 {
--- 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"
--- 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;
--- 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;