pidgin: 1356c46a: Add an error handler for the RML command...

qulogic at pidgin.im qulogic at pidgin.im
Fri Oct 30 02:55:56 EDT 2009


-----------------------------------------------------------------
Revision: 1356c46a0afabeaf938b12405035e8c01aa73d54
Ancestor: 466621b1494b45efe11f835ff3cb5a647d1da7b6
Author: qulogic at pidgin.im
Date: 2009-10-30T03:52:09
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1356c46a0afabeaf938b12405035e8c01aa73d54

Modified files:
        libpurple/protocols/msn/notification.c

ChangeLog: 

Add an error handler for the RML command as well.

Fixes #10613.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/notification.c	71f8d1c7c22302cc663d62ed5c1372e994a2d759
+++ libpurple/protocols/msn/notification.c	d54071f4d05e5c4b868d7dfeecfe2cc03ce62039
@@ -909,6 +909,52 @@ static void
 }
 
 static void
+rml_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len)
+{
+	MsnSession *session;
+	PurpleAccount *account;
+	PurpleConnection *gc;
+	char *adl, *reason;
+	int error = GPOINTER_TO_INT(cmd->payload_cbdata);
+
+	session = cmdproc->session;
+	account = session->account;
+	gc = purple_account_get_connection(account);
+
+	adl = g_strndup(payload, len);
+	reason = g_strdup_printf(_("Unknown error (%d): %s"),
+		error, adl);
+	g_free(adl);
+
+	purple_notify_error(gc, NULL, _("Unable to remove user"), reason);
+	g_free(reason);
+}
+
+static void
+rml_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
+{
+	MsnSession *session;
+	PurpleAccount *account;
+	PurpleConnection *gc;
+	MsnCommand *cmd = cmdproc->last_cmd;
+
+	session = cmdproc->session;
+	account = session->account;
+	gc = purple_account_get_connection(account);
+
+	purple_debug_error("msn", "RML error\n");
+	if (cmd->param_count > 1) {
+		cmd->payload_cb = rml_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 remove user"), reason);
+		g_free(reason);
+	}
+}
+
+static void
 fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
 			 size_t len)
 {
@@ -2080,6 +2126,7 @@ msn_notification_init(void)
 	msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd);
 
 	msn_table_add_error(cbs_table, "ADL", adl_error);
+	msn_table_add_error(cbs_table, "RML", rml_error);
 	msn_table_add_error(cbs_table, "FQY", fqy_error);
 	msn_table_add_error(cbs_table, "USR", usr_error);
 


More information about the Commits mailing list