pidgin: 12a47a48: Report an error when an MSN Mobile messa...
qulogic at pidgin.im
qulogic at pidgin.im
Fri Jul 18 23:30:48 EDT 2008
-----------------------------------------------------------------
Revision: 12a47a486209652090154b7c125cd51a39f50c64
Ancestor: 5d46ff2bb6f7d636573cccf1bc6864ae33ad9225
Author: qulogic at pidgin.im
Date: 2008-07-18T02:37:20
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/12a47a486209652090154b7c125cd51a39f50c64
Modified files:
libpurple/protocols/msn/notification.c
ChangeLog:
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.
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/notification.c 1fde905033e0673b9e3455d6d744b026ec480b6c
+++ libpurple/protocols/msn/notification.c bf9939fd7dddaf329b05adf6694b46dbf507d449
@@ -989,7 +989,8 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCom
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 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCom
</NOTIFICATION>
*/
+ /* This is the payload if your message was too long:
+ <NOTIFICATION id="TrID" siteid="111100400" siteurl="http://mobile.msn.com/">
+ <TO name="passport at example.com">
+ <VIA agent="mobile"/>
+ </TO>
+ <FROM name="tel:+XXXXXXXXXXX"/>
+ <MSG pri="1" id="407">
+ <CAT Id="110110001"/>
+ <ACTION url="2wayIM.asp"/>
+ <SUBSCR url="2wayIM.asp"/>
+ <BODY lcid="1033">
+ <TEXT></TEXT>
+ </BODY>
+ </MSG>
+ </NOTIFICATION>
+ */
+
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 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCom
/* 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,8 +1055,21 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCom
}
}
- 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);
xmlnode_free(payloadNode);
More information about the Commits
mailing list