Mercurial > pidgin.yaz
changeset 28414:e7a2e2208f88
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.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 22 Aug 2009 20:51:56 +0000 |
parents | f1a8a28432f4 |
children | 7cebd7602c6e |
files | libpurple/protocols/msn/msn.c libpurple/protocols/msn/notification.c |
diffstat | 2 files changed, 33 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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)); }