changeset 31386:d66112347eb4

merge of '1577331230de94bf1d081cb81f03ae1271cf8960' and '85490424ef0ad56f257b7f2cc39e24e51d2fe160'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 14 Mar 2011 04:34:34 +0000
parents 539b7170c7df (diff) dc1b3cb85f51 (current diff)
children 9710b3226f11 ea07a6230b57
files
diffstat 4 files changed, 29 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msg.c	Mon Mar 14 02:56:07 2011 +0000
+++ b/libpurple/protocols/msn/msg.c	Mon Mar 14 04:34:34 2011 +0000
@@ -613,7 +613,8 @@
 
 	if (msg->msnslp_message)
 	{
-		msn_slpmsgpart_to_string(msg->part, str);
+		if (msg->part)
+			msn_slpmsgpart_to_string(msg->part, str);
 
 		if (purple_debug_is_verbose() && body != NULL)
 		{
--- a/libpurple/protocols/msn/notification.c	Mon Mar 14 02:56:07 2011 +0000
+++ b/libpurple/protocols/msn/notification.c	Mon Mar 14 04:34:34 2011 +0000
@@ -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;
+					}
 				}
 			}
 		}
--- a/libpurple/protocols/msn/oim.c	Mon Mar 14 02:56:07 2011 +0000
+++ b/libpurple/protocols/msn/oim.c	Mon Mar 14 04:34:34 2011 +0000
@@ -175,7 +175,8 @@
 
 		if (faultcode_str) {
 			if (g_str_equal(faultcode_str, "q0:BadContextToken") ||
-				g_str_equal(faultcode_str, "AuthenticationFailed"))
+				g_str_equal(faultcode_str, "AuthenticationFailed") ||
+				g_str_equal(faultcode_str, "s:AuthenticationFailed"))
 				need_token_update = TRUE;
 			else if (g_str_equal(faultcode_str, "q0:AuthenticationFailed") &&
 				xmlnode_get_child(fault, "detail/RequiredAuthPolicy") != NULL)
--- a/libpurple/protocols/msn/switchboard.c	Mon Mar 14 02:56:07 2011 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Mon Mar 14 04:34:34 2011 +0000
@@ -726,6 +726,7 @@
 	g_return_if_fail(msg != NULL);
 
 	msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_NAK);
+	cmd->trans->data = NULL;
 }
 
 static void
@@ -743,6 +744,7 @@
 	if (swboard)
 		swboard->ack_list = g_list_remove(swboard->ack_list, msg);
 	msn_message_unref(msg);
+	cmd->trans->data = NULL;
 }
 
 static void