From: Stu T. <nos...@us...> - 2004-12-12 17:37:56
|
Update of /cvsroot/gaim/gaim/src/protocols/msn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31323/src/protocols/msn Modified Files: msg.h msn.c slp.h slplink.c switchboard.c switchboard.h Log Message: More more MSN bug fixes from Felipe Contreras, and I fixed up the display of messages that failed to send so that it matches what you tried to send and doesn't have kittens with html entities and such. I added a GAIM_MESSAGE_RAW type in HEAD to make the display of such messages even more accurate, but I don't think such a cosmetic change, which would bump us to 1.2.0, is all that important for oldstatus. Index: msg.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/msn/msg.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -p -r1.16 -r1.17 --- msg.h 11 Dec 2004 20:01:58 -0000 1.16 +++ msg.h 12 Dec 2004 17:37:35 -0000 1.17 @@ -109,13 +109,16 @@ struct _MsnMessage GHashTable *attr_table; GList *attr_list; + gboolean ack_ref; /**< A flag that states if this message has + been ref'ed for using it in a callback. */ + MsnCommand *cmd; MsnTransaction *trans; MsnMsgCb ack_cb; /**< The callback to call when we receive an ACK of this - message. */ + message. */ MsnMsgCb nak_cb; /**< The callback to call when we receive a NAK of this - message. */ + message. */ void *ack_data; /**< The data used by callbacks. */ MsnMsgErrorType error; /**< The error of the message. */ Index: msn.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/msn/msn.c,v retrieving revision 1.339 retrieving revision 1.340 diff -u -d -p -r1.339 -r1.340 --- msn.c 11 Dec 2004 20:01:58 -0000 1.339 +++ msn.c 12 Dec 2004 17:37:36 -0000 1.340 @@ -781,6 +781,7 @@ msn_send_im(GaimConnection *gc, const ch format = msn_message_get_attr(msg, "X-MMS-IM-Format"); msn_parse_format(format, &pre, &post); body_str = g_strdup_printf("%s%s%s", pre, body_enc, post); + g_free(body_enc); g_free(pre); g_free(post); @@ -824,6 +825,9 @@ msn_send_typing(GaimConnection *gc, cons if (swboard->empty) return 0; + if (!g_queue_is_empty(swboard->im_queue)) + return 0; + msg = msn_message_new(MSN_MSG_TYPING); msn_message_set_content_type(msg, "text/x-msmsgscontrol"); msn_message_set_flag(msg, 'U'); @@ -831,16 +835,7 @@ msn_send_typing(GaimConnection *gc, cons gaim_account_get_username(account)); msn_message_set_bin_data(msg, "\r\n", 2); - swboard = msn_session_get_swboard(session, who); - - if (!g_queue_is_empty(swboard->im_queue) || swboard->empty) - { - msn_switchboard_queue_msg(swboard, msg); - } - else - { - msn_switchboard_send_msg(swboard, msg); - } + msn_switchboard_send_msg(swboard, msg); msn_message_destroy(msg); Index: slp.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/msn/slp.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -p -r1.7 -r1.8 --- slp.h 11 Dec 2004 20:01:58 -0000 1.7 +++ slp.h 12 Dec 2004 17:37:36 -0000 1.8 @@ -24,7 +24,7 @@ #ifndef _MSN_SLP_H_ #define _MSN_SLP_H_ -/* #define MSN_DEBUG_MSG 1 */ +#define MSN_DEBUG_MSG 1 /* #define MSN_DEBUG_SLPMSG 1 */ /* #define MSN_DEBUG_SLP 1 */ Index: slplink.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/msn/slplink.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -p -r1.20 -r1.21 --- slplink.c 11 Dec 2004 20:01:58 -0000 1.20 +++ slplink.c 12 Dec 2004 17:37:36 -0000 1.21 @@ -209,7 +209,7 @@ msn_slplink_send_msg(MsnSlpLink *slplink if (slplink->swboard == NULL) return; - /* If swboard is destroyed we will too */ + /* If swboard is destroyed we will be too */ slplink->swboard->slplink = slplink; } Index: switchboard.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/msn/switchboard.c,v retrieving revision 1.85 retrieving revision 1.86 diff -u -d -p -r1.85 -r1.86 --- switchboard.c 11 Dec 2004 20:01:58 -0000 1.85 +++ switchboard.c 12 Dec 2004 17:37:36 -0000 1.86 @@ -201,6 +201,7 @@ msn_switchboard_add_user(MsnSwitchBoard swboard->users = g_list_prepend(swboard->users, g_strdup(user)); swboard->current_users++; + swboard->empty = FALSE; /* gaim_debug_info("msn", "user=[%s], total=%d\n", user, * swboard->current_users); */ @@ -276,7 +277,7 @@ msn_switchboard_get_conv(MsnSwitchBoard if (swboard->conv != NULL) return swboard->conv; - gaim_debug_error("msn", "Switchboard with unnasigned conversation\n"); + gaim_debug_error("msn", "Switchboard with unassigned conversation\n"); account = swboard->session->account; @@ -341,8 +342,8 @@ msg_error_helper(MsnCmdProc *cmdproc, Ms if (msg->type == MSN_MSG_TEXT) { MsnSwitchBoard *swboard; - char *body; - char *report; + const char *format; + char *body_str, *body_enc, *pre, *post; char *str_reason; swboard = cmdproc->servconn->data; @@ -350,61 +351,68 @@ msg_error_helper(MsnCmdProc *cmdproc, Ms #if 0 if (swboard->conv == NULL) { - msn_message_unref(msg); + if (msg->ack_ref) + msn_message_unref(msg); + return; } #endif - if (msg->error == MSN_MSG_ERROR_TIMEOUT) + if (error == MSN_MSG_ERROR_TIMEOUT) { str_reason = _("Message may have not been sent " - "because a time out occured."); + "because a time out occured:"); } - else if (msg->error == MSN_MSG_ERROR_SB) + else if (error == MSN_MSG_ERROR_SB) { switch (swboard->error) { case MSN_SB_ERROR_OFFLINE: str_reason = _("Message could not be sent, " - "not allowed while invisible"); + "not allowed while invisible:"); break; case MSN_SB_ERROR_USER_OFFLINE: str_reason = _("Message could not be sent " - "because the user is offline"); + "because the user is offline:"); break; case MSN_SB_ERROR_CONNECTION: str_reason = _("Message could not be sent " - "because a connection error occured"); + "because a connection error occured:"); break; default: str_reason = _("Message could not be sent " "because an error with " - "the switchboard occured"); + "the switchboard occured:"); break; } } else { str_reason = _("Message may have not been sent " - "because an unkwown error occured"); + "because an unkwown error occured:"); } - body = msn_message_to_string(msg); - report = g_strdup_printf(_("%s:\n%s"), str_reason, body); + body_str = msn_message_to_string(msg); + body_enc = gaim_escape_html(body_str); + g_free(body_str); - msn_switchboard_report_user(cmdproc->servconn->data, - GAIM_MESSAGE_ERROR, report); + format = msn_message_get_attr(msg, "X-MMS-IM-Format"); + msn_parse_format(format, &pre, &post); + body_str = g_strdup_printf("%s%s%s", pre, body_enc, post); + g_free(body_enc); + g_free(pre); + g_free(post); - g_free(report); - g_free(body); + msn_switchboard_report_user(cmdproc->servconn->data, + GAIM_MESSAGE_ERROR, str_reason); + msn_switchboard_report_user(cmdproc->servconn->data, + GAIM_MESSAGE_RAW, body_str); - msn_message_unref(msg); - } - else if (msg->type == MSN_MSG_SLP) - { - msn_message_unref(msg); + g_free(body_str); } + if (msg->ack_ref) + msn_message_unref(msg); } /************************************************************************** @@ -515,8 +523,6 @@ joi_cmd(MsnCmdProc *cmdproc, MsnCommand msn_switchboard_add_user(swboard, passport); - swboard->empty = FALSE; - msn_switchboard_process_queue(swboard); send_clientcaps(swboard); @@ -789,11 +795,13 @@ msn_switchboard_send_msg(MsnSwitchBoard if (msg->type == MSN_MSG_TEXT) { + msg->ack_ref = TRUE; msn_message_ref(msg); msn_transaction_set_timeout_cb(trans, msg_timeout); } else if (msg->type == MSN_MSG_SLP) { + msg->ack_ref = TRUE; msn_message_ref(msg); msn_transaction_set_timeout_cb(trans, msg_timeout); #if 0 @@ -862,10 +870,10 @@ connect_cb(MsnServConn *servconn) swboard = servconn->data; g_return_if_fail(swboard != NULL); - swboard->empty = FALSE; - if (msn_switchboard_is_invited(swboard)) { + swboard->empty = FALSE; + msn_cmdproc_send(cmdproc, "ANS", "%s %s %s", gaim_account_get_username(account), swboard->auth_key, swboard->session_id); Index: switchboard.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/msn/switchboard.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -p -r1.16 -r1.17 --- switchboard.h 11 Dec 2004 20:01:58 -0000 1.16 +++ switchboard.h 12 Dec 2004 17:37:36 -0000 1.17 @@ -40,12 +40,12 @@ typedef struct _MsnSwitchBoard MsnSwitch */ typedef enum { - MSN_SB_ERROR_NONE, /**< No error */ - MSN_SB_ERROR_CAL, /**< The user could not join (answer the call) */ - MSN_SB_ERROR_OFFLINE, /**< The account is offline */ - MSN_SB_ERROR_USER_OFFLINE, /**< The user to call is offline */ - MSN_SB_ERROR_CONNECTION, /**< There was a connection error */ - MSN_SB_ERROR_UNKNOWN /**< An unknown error occured */ + MSN_SB_ERROR_NONE, /**< No error. */ + MSN_SB_ERROR_CAL, /**< The user could not join (answer the call). */ + MSN_SB_ERROR_OFFLINE, /**< The account is offline. */ + MSN_SB_ERROR_USER_OFFLINE, /**< The user to call is offline. */ + MSN_SB_ERROR_CONNECTION, /**< There was a connection error. */ + MSN_SB_ERROR_UNKNOWN /**< An unknown error occured. */ } MsnSBErrorType; |