changeset 24267:e473291375b4

Apply khc's patch for ADL error 205, with a few changes to get around string freeze. This should allow people to login for this release since I removed the previous workaround. References #6640.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 19 Oct 2008 05:45:16 +0000
parents 7ec9a1ae93d7
children 32e5515232b9
files libpurple/protocols/msn/command.h libpurple/protocols/msn/notification.c
diffstat 2 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/command.h	Thu Oct 02 05:37:38 2008 +0000
+++ b/libpurple/protocols/msn/command.h	Sun Oct 19 05:45:16 2008 +0000
@@ -51,6 +51,7 @@
 	size_t payload_len;
 
 	MsnPayloadCb payload_cb;
+	void *payload_cbdata;
 };
 
 MsnCommand *msn_command_from_string(const char *string);
--- a/libpurple/protocols/msn/notification.c	Thu Oct 02 05:37:38 2008 +0000
+++ b/libpurple/protocols/msn/notification.c	Sun Oct 19 05:45:16 2008 +0000
@@ -753,21 +753,46 @@
 }
 
 static void
+adl_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len)
+{
+	MsnSession *session;
+	PurpleAccount *account;
+	PurpleConnection *gc;
+	/*char *adl = g_strndup(payload, len);*/
+	char *reason = g_strdup_printf(_("Unknown error (%d)"),
+		GPOINTER_TO_INT(cmd->payload_cbdata)/*, adl*/);
+	/*g_free(adl);*/
+
+	session = cmdproc->session;
+	account = session->account;
+	gc = purple_account_get_connection(account);
+
+	purple_notify_error(gc, NULL, _("Unable to add user"), reason);
+	g_free(reason);
+}
+
+static void
 adl_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
 {
 	MsnSession *session;
 	PurpleAccount *account;
 	PurpleConnection *gc;
-	char *reason = NULL;
+	MsnCommand *cmd = cmdproc->last_cmd;
 
 	session = cmdproc->session;
 	account = session->account;
 	gc = purple_account_get_connection(account);
 
 	purple_debug_error("msn", "ADL error\n");
-	reason = g_strdup_printf(_("Unknown error (%d)"), error);
-	purple_notify_error(gc, NULL, _("Unable to add user"), reason);
-	g_free(reason);
+	if (cmd->param_count > 1) {
+		cmd->payload_cb = adl_error_parse;
+		cmd->payload_len = atoi(cmd->params[1]);
+		cmd->payload_cbdata = GINT_TO_POINTER(error);
+	} else {
+		char *reason = g_strdup_printf(_("Unknown error (%d)"), error);
+		purple_notify_error(gc, NULL, _("Unable to add user"), reason);
+		g_free(reason);
+	}
 }
 
 static void