Mercurial > pidgin.yaz
comparison libpurple/protocols/msn/notification.c @ 28840:12bdd930d99c
Add an error handler for the RML command as well.
Fixes #10613.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 30 Oct 2009 03:52:09 +0000 |
parents | 57137d32a131 |
children | dd5026ca598a |
comparison
equal
deleted
inserted
replaced
28839:57137d32a131 | 28840:12bdd930d99c |
---|---|
907 g_free(reason); | 907 g_free(reason); |
908 } | 908 } |
909 } | 909 } |
910 | 910 |
911 static void | 911 static void |
912 rml_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) | |
913 { | |
914 MsnSession *session; | |
915 PurpleAccount *account; | |
916 PurpleConnection *gc; | |
917 char *adl, *reason; | |
918 int error = GPOINTER_TO_INT(cmd->payload_cbdata); | |
919 | |
920 session = cmdproc->session; | |
921 account = session->account; | |
922 gc = purple_account_get_connection(account); | |
923 | |
924 adl = g_strndup(payload, len); | |
925 reason = g_strdup_printf(_("Unknown error (%d): %s"), | |
926 error, adl); | |
927 g_free(adl); | |
928 | |
929 purple_notify_error(gc, NULL, _("Unable to remove user"), reason); | |
930 g_free(reason); | |
931 } | |
932 | |
933 static void | |
934 rml_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) | |
935 { | |
936 MsnSession *session; | |
937 PurpleAccount *account; | |
938 PurpleConnection *gc; | |
939 MsnCommand *cmd = cmdproc->last_cmd; | |
940 | |
941 session = cmdproc->session; | |
942 account = session->account; | |
943 gc = purple_account_get_connection(account); | |
944 | |
945 purple_debug_error("msn", "RML error\n"); | |
946 if (cmd->param_count > 1) { | |
947 cmd->payload_cb = rml_error_parse; | |
948 cmd->payload_len = atoi(cmd->params[1]); | |
949 cmd->payload_cbdata = GINT_TO_POINTER(error); | |
950 } else { | |
951 char *reason = g_strdup_printf(_("Unknown error (%d)"), error); | |
952 purple_notify_error(gc, NULL, _("Unable to remove user"), reason); | |
953 g_free(reason); | |
954 } | |
955 } | |
956 | |
957 static void | |
912 fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, | 958 fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, |
913 size_t len) | 959 size_t len) |
914 { | 960 { |
915 MsnSession *session; | 961 MsnSession *session; |
916 xmlnode *ml, *d, *c; | 962 xmlnode *ml, *d, *c; |
2078 msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd); | 2124 msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd); |
2079 | 2125 |
2080 msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd); | 2126 msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd); |
2081 | 2127 |
2082 msn_table_add_error(cbs_table, "ADL", adl_error); | 2128 msn_table_add_error(cbs_table, "ADL", adl_error); |
2129 msn_table_add_error(cbs_table, "RML", rml_error); | |
2083 msn_table_add_error(cbs_table, "FQY", fqy_error); | 2130 msn_table_add_error(cbs_table, "FQY", fqy_error); |
2084 msn_table_add_error(cbs_table, "USR", usr_error); | 2131 msn_table_add_error(cbs_table, "USR", usr_error); |
2085 | 2132 |
2086 msn_table_add_msg_type(cbs_table, | 2133 msn_table_add_msg_type(cbs_table, |
2087 "text/x-msmsgsprofile", | 2134 "text/x-msmsgsprofile", |