summaryrefslogtreecommitdiff
path: root/libpurple/protocols/msn/notification.c
diff options
context:
space:
mode:
Diffstat (limited to 'libpurple/protocols/msn/notification.c')
-rw-r--r--libpurple/protocols/msn/notification.c52
1 files changed, 44 insertions, 8 deletions
diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c
index d64d52f6a1..9aef684904 100644
--- a/libpurple/protocols/msn/notification.c
+++ b/libpurple/protocols/msn/notification.c
@@ -599,6 +599,8 @@ update_contact_network(MsnSession *session, const char *passport, MsnNetwork net
/* Decrement the count for unknown results so that we'll continue login.
Also, need to finish the login process here as well, because ADL OK
will not be called. */
+ if (purple_debug_is_verbose())
+ purple_debug_info("msn", "ADL/FQY count is %d\n", session->adl_fqy);
if (--session->adl_fqy == 0)
msn_session_finish_login(session);
return;
@@ -680,6 +682,9 @@ msn_notification_dump_contact(MsnSession *session)
/* ADL's are returned all-together */
session->adl_fqy++;
+ if (purple_debug_is_verbose())
+ purple_debug_info("msn", "Posting ADL, count is %d\n",
+ session->adl_fqy);
msn_notification_post_adl(session->notification->cmdproc,
payload, payload_len);
@@ -694,6 +699,9 @@ msn_notification_dump_contact(MsnSession *session)
} else {
/* FQY's are returned one-at-a-time */
session->adl_fqy++;
+ if (purple_debug_is_verbose())
+ purple_debug_info("msn", "Adding FQY address, count is %d\n",
+ session->adl_fqy);
msn_add_contact_xml(session, fqy_node, user->passport,
0, user->networkid);
@@ -718,6 +726,9 @@ msn_notification_dump_contact(MsnSession *session)
/* ADL's are returned all-together */
session->adl_fqy++;
+ if (purple_debug_is_verbose())
+ purple_debug_info("msn", "Posting ADL, count is %d\n",
+ session->adl_fqy);
msn_notification_post_adl(session->notification->cmdproc, payload, payload_len);
@@ -809,6 +820,9 @@ adl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
if (!strcmp(cmd->params[1], "OK")) {
/* ADL ack */
+ if (purple_debug_is_verbose())
+ purple_debug_info("msn", "ADL ACK, count is %d\n",
+ session->adl_fqy);
if (--session->adl_fqy == 0)
msn_session_finish_login(session);
} else {
@@ -1178,14 +1192,36 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len)
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));
}