Mercurial > pidgin
diff src/protocols/msn/switchboard.c @ 10346:bbf738a0ce7b
[gaim-migrate @ 11560]
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.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 12 Dec 2004 17:37:36 +0000 |
parents | 2e01c503aa4f |
children | 38256d3e8324 |
line wrap: on
line diff
--- a/src/protocols/msn/switchboard.c Sat Dec 11 20:01:58 2004 +0000 +++ b/src/protocols/msn/switchboard.c Sun Dec 12 17:37:36 2004 +0000 @@ -201,6 +201,7 @@ 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 @@ 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 @@ 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 @@ #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); + + 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); msn_switchboard_report_user(cmdproc->servconn->data, - GAIM_MESSAGE_ERROR, report); - - g_free(report); - g_free(body); + 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 @@ msn_switchboard_add_user(swboard, passport); - swboard->empty = FALSE; - msn_switchboard_process_queue(swboard); send_clientcaps(swboard); @@ -789,11 +795,13 @@ 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 @@ 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);