changeset 24208:32e5515232b9

merge of '0e036cef0f8a3bdfd1d7f7fc082edca43d3153df' and 'ba83d353849378608f614eb7900d63ebbcfdb50d'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 19 Oct 2008 05:48:11 +0000
parents c35bb090d1f3 (current diff) e473291375b4 (diff)
children d37bff820b2d
files libpurple/protocols/msn/notification.c
diffstat 2 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/command.h	Sun Oct 19 02:41:57 2008 +0000
+++ b/libpurple/protocols/msn/command.h	Sun Oct 19 05:48:11 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	Sun Oct 19 02:41:57 2008 +0000
+++ b/libpurple/protocols/msn/notification.c	Sun Oct 19 05:48:11 2008 +0000
@@ -756,21 +756,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