# HG changeset patch # User Elliott Sales de Andrade # Date 1216348640 0 # Node ID d370388bfc89765a82c938d005ad345dc6780a8d # Parent a97c1628c8032e7d0ce96ecf6e09ad1696c3102b Report an error when an MSN Mobile message was not sent because it was too long. I think this might need to be reported better, though. References #5448. diff -r a97c1628c803 -r d370388bfc89 libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Fri Jul 18 01:00:52 2008 +0000 +++ b/libpurple/protocols/msn/notification.c Fri Jul 18 02:37:20 2008 +0000 @@ -989,7 +989,8 @@ PurpleConnection *gc; MsnUserList *userlist; char *who = NULL, *text = NULL; - xmlnode *payloadNode, *from, *textNode; + const char *id = NULL; + xmlnode *payloadNode, *from, *msg, *textNode; purple_debug_misc("msn", "Incoming Page: {%s}\n", payload); @@ -1014,9 +1015,27 @@ */ + /* This is the payload if your message was too long: + + + + + + + + + + + + + + + */ + if (!(payloadNode = xmlnode_from_str(payload, len)) || !(from = xmlnode_get_child(payloadNode, "FROM")) || - !(textNode = xmlnode_get_child(payloadNode, "MSG/BODY/TEXT"))) + !(msg = xmlnode_get_child(payloadNode, "MSG")) || + !(textNode = xmlnode_get_child(msg, "BODY/TEXT"))) return; who = g_strdup(xmlnode_get_attrib(from, "name")); @@ -1026,7 +1045,7 @@ /* Match number to user's mobile number, FROM is a phone number if the other side page you using your phone number */ - if(!strncmp(who, "tel:+", 5)) { + if (!strncmp(who, "tel:+", 5)) { MsnUser *user = msn_userlist_find_user_with_mobile_phone(userlist, who + 4); @@ -1036,7 +1055,20 @@ } } - serv_got_im(gc, who, text, 0, time(NULL)); + 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.")); + + } else { + serv_got_im(gc, who, text, 0, time(NULL)); + } g_free(text); g_free(who);