changeset 26784:0c077a605b8a

Add an FQY error handler so we don't disconnect if something incorrect was sent (unless the server kicked us itself). References #8588.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 02 May 2009 22:31:13 +0000
parents 2a3019c06631
children bbb89d322034
files libpurple/protocols/msn/notification.c
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c	Sat May 02 21:13:02 2009 +0000
+++ b/libpurple/protocols/msn/notification.c	Sat May 02 22:31:13 2009 +0000
@@ -914,6 +914,26 @@
 }
 
 static void
+fqy_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len)
+{
+	purple_debug_warning("msn", "FQY error %d: %s\n",
+	                     GPOINTER_TO_INT(cmd->payload_cbdata), payload);
+}
+
+static void
+fqy_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
+{
+	MsnCommand *cmd = cmdproc->last_cmd;
+
+	purple_debug_error("msn", "FQY error %d\n", error);
+	if (cmd->param_count > 1) {
+		cmd->payload_cb = fqy_error_parse;
+		cmd->payload_len = atoi(cmd->params[1]);
+		cmd->payload_cbdata = GINT_TO_POINTER(error);
+	}
+}
+
+static void
 fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
 			 size_t len)
 {
@@ -2153,6 +2173,7 @@
 
 	msn_table_add_error(cbs_table, "ADD", add_error);
 	msn_table_add_error(cbs_table, "ADL", adl_error);
+	msn_table_add_error(cbs_table, "FQY", fqy_error);
 	msn_table_add_error(cbs_table, "REG", reg_error);
 	msn_table_add_error(cbs_table, "RMG", rmg_error);
 	msn_table_add_error(cbs_table, "USR", usr_error);