# HG changeset patch # User Elliott Sales de Andrade # Date 1250974316 0 # Node ID e7a2e2208f88cca0e7c955df20920a1cb112d64a # Parent f1a8a28432f48db028a67d7ff544a7770098c076 Display the full message when there are errors sending a MSN Mobile message which should match errors with regular messages. Maiku tells me this should work properly. Fixes #5448. diff -r f1a8a28432f4 -r e7a2e2208f88 libpurple/protocols/msn/msn.c --- a/libpurple/protocols/msn/msn.c Sat Aug 22 19:35:02 2009 +0000 +++ b/libpurple/protocols/msn/msn.c Sat Aug 22 20:51:56 2009 +0000 @@ -265,6 +265,7 @@ MsnSession *session; MsnCmdProc *cmdproc; MsnPage *page; + MsnMessage *msg; MsnUser *user; char *payload = NULL; const char *mobile_number = NULL; @@ -295,6 +296,9 @@ msn_transaction_set_payload(trans, payload, payload_len); g_free(payload); + msg = msn_message_new_plain(entry); + msn_transaction_set_data(trans, msg); + msn_page_destroy(page); msn_cmdproc_send_trans(cmdproc, trans); diff -r f1a8a28432f4 -r e7a2e2208f88 libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Sat Aug 22 19:35:02 2009 +0000 +++ b/libpurple/protocols/msn/notification.c Sat Aug 22 20:51:56 2009 +0000 @@ -1178,14 +1178,36 @@ id = xmlnode_get_attrib(msg, "id"); if (id && !strcmp(id, "407")) { - /* TODO: Use this to NAK the transaction, maybe print the text, too. - unsigned int trId; - id = xmlnode_get_attrib(payloadNode, "id"); - trId = atol(id); - */ - purple_conv_present_error(who, gc->account, - _("Mobile message was not sent because it was too long.")); + PurpleConversation *conv + = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, + who, gc->account); + if (conv != NULL) { + purple_conversation_write(conv, NULL, + _("Mobile message was not sent because it was too long."), + PURPLE_MESSAGE_ERROR, time(NULL)); + + if ((id = xmlnode_get_attrib(payloadNode, "id")) != NULL) { + unsigned int trId = atol(id); + MsnTransaction *trans; + MsnMessage *msg; + trans = msn_history_find(cmdproc->history, trId); + msg = (MsnMessage *)trans->data; + + if (msg) { + char *body_str = msn_message_to_string(msg); + char *body_enc = g_markup_escape_text(body_str, -1); + + purple_conversation_write(conv, NULL, body_enc, + PURPLE_MESSAGE_RAW, time(NULL)); + + g_free(body_str); + g_free(body_enc); + msn_message_destroy(msg); + trans->data = NULL; + } + } + } } else { serv_got_im(gc, who, text, 0, time(NULL)); }