diff libpurple/protocols/msn/notification.c @ 31558:ce968e115c95

propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64) to branch 'im.pidgin.pidgin' (head 92f47f4e8b0cbb107fd97e1ab814d1cedbf109ad)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 06 May 2011 06:25:14 +0000
parents 7b021b6a09af
children 747c5be08e81
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c	Tue Jan 04 05:05:06 2011 +0000
+++ b/libpurple/protocols/msn/notification.c	Fri May 06 06:25:14 2011 +0000
@@ -1099,7 +1099,7 @@
 
 	msn_user_set_object(user, msnobj);
 
-	user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+');
+	user->mobile = (clientid & MSN_CAP_MOBILE_ON) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+');
 	msn_user_set_clientid(user, clientid);
 	msn_user_set_extcaps(user, extcaps);
 	msn_user_set_network(user, networkid);
@@ -1186,34 +1186,40 @@
 
 	id = xmlnode_get_attrib(msg, "id");
 
-	if (id && !strcmp(id, "407")) {
+	if (id && strcmp(id, "1")) {
 		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."),
+			const char *error;
+			if (!strcmp(id, "407"))
+				error = _("Mobile message was not sent because it was too long.");
+			else
+				error = _("Mobile message was not sent because an unknown error occurred.");
+
+			purple_conversation_write(conv, NULL, error,
 			                          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_unref(msg);
-					trans->data = NULL;
+				if (trans) {
+					MsnMessage *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_unref(msg);
+						trans->data = NULL;
+					}
 				}
 			}
 		}
@@ -1274,7 +1280,7 @@
 	else
 		extcaps = 0;
 
-	user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+');
+	user->mobile = (clientid & MSN_CAP_MOBILE_ON) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+');
 
 	msn_user_set_clientid(user, clientid);
 	msn_user_set_extcaps(user, extcaps);
@@ -2216,7 +2222,7 @@
 }
 
 /**************************************************************************
- * Dispatch server list management 
+ * Dispatch server list management
  **************************************************************************/
 typedef struct MsnAddRemoveListData {
 	MsnCmdProc *cmdproc;