pidgin: cf6de57a: Display the full message when there are ...
qulogic at pidgin.im
qulogic at pidgin.im
Sat Aug 22 19:35:52 EDT 2009
-----------------------------------------------------------------
Revision: cf6de57a67ba9d191b77aa1f1ab13d9980ce5cb1
Ancestor: 47a1e727a78b5fd20a13a36ac69f73845d44d101
Author: qulogic at pidgin.im
Date: 2009-08-22T20:51:56
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/cf6de57a67ba9d191b77aa1f1ab13d9980ce5cb1
Modified files:
libpurple/protocols/msn/msn.c
libpurple/protocols/msn/notification.c
ChangeLog:
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.
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c ff39dd4766123d4754073db668c12a2a9f118994
+++ libpurple/protocols/msn/msn.c 160c0a0bdb2566d8b2b2620ce4832a5e2731b8c2
@@ -265,6 +265,7 @@ send_to_mobile(PurpleConnection *gc, con
MsnSession *session;
MsnCmdProc *cmdproc;
MsnPage *page;
+ MsnMessage *msg;
MsnUser *user;
char *payload = NULL;
const char *mobile_number = NULL;
@@ -295,6 +296,9 @@ send_to_mobile(PurpleConnection *gc, con
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);
============================================================
--- libpurple/protocols/msn/notification.c fd5c2380098900d00c777434dc955808f014e984
+++ libpurple/protocols/msn/notification.c 6aa3397f80df1c74d4ca15571b1bd9b66e56a68d
@@ -1178,14 +1178,36 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCom
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));
}
More information about the Commits
mailing list