Mercurial > hg
changeset 1701:44e023ad99ed
Add dummy handler for roster manipulation IQ responses
This clears up the "Unhandled IQ" messages, only errors should displayed now.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 07 Feb 2010 19:13:33 +0100 |
parents | 87dd0a8f1a9c |
children | 02039190532d |
files | mcabber/mcabber/xmpp.c mcabber/mcabber/xmpp_iq.c mcabber/mcabber/xmpp_iq.h |
diffstat | 3 files changed, 29 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/mcabber/xmpp.c Sun Feb 07 17:34:00 2010 +0100 +++ b/mcabber/mcabber/xmpp.c Sun Feb 07 19:13:33 2010 +0100 @@ -106,6 +106,7 @@ { LmMessageNode *query, *y; LmMessage *iq; + LmMessageHandler *handler; char *cleanjid; if (!xmpp_is_online()) @@ -129,7 +130,9 @@ if (group) lm_message_node_add_child(y, "group", group); - lm_connection_send(lconnection, iq, NULL); + handler = lm_message_handler_new(handle_iq_dummy, NULL, FALSE); + lm_connection_send_with_reply(lconnection, iq, handler, NULL); + lm_message_handler_unref(handler); lm_message_unref(iq); xmpp_send_s10n(cleanjid, LM_MESSAGE_SUB_TYPE_SUBSCRIBE); @@ -144,6 +147,7 @@ void xmpp_updatebuddy(const char *bjid, const char *name, const char *group) { LmMessage *iq; + LmMessageHandler *handler; LmMessageNode *x; char *cleanjid; @@ -167,7 +171,9 @@ if (group) lm_message_node_add_child(x, "group", group); - lm_connection_send(lconnection, iq, NULL); + handler = lm_message_handler_new(handle_iq_dummy, NULL, FALSE); + lm_connection_send_with_reply(lconnection, iq, handler, NULL); + lm_message_handler_unref(handler); lm_message_unref(iq); g_free(cleanjid); } @@ -176,6 +182,7 @@ { LmMessageNode *y, *z; LmMessage *iq; + LmMessageHandler *handler; char *cleanjid; if (!xmpp_is_online()) @@ -211,7 +218,9 @@ "jid", cleanjid, "subscription", "remove", NULL); - lm_connection_send(lconnection, iq, NULL); + handler = lm_message_handler_new(handle_iq_dummy, NULL, FALSE); + lm_connection_send_with_reply(lconnection, iq, handler, NULL); + lm_message_handler_unref(handler); lm_message_unref(iq); roster_del_user(cleanjid);
--- a/mcabber/mcabber/xmpp_iq.c Sun Feb 07 17:34:00 2010 +0100 +++ b/mcabber/mcabber/xmpp_iq.c Sun Feb 07 19:13:33 2010 +0100 @@ -144,6 +144,17 @@ lm_message_node_add_child(field, "value", message); } +// Dummy handler to ignore IQ response +LmHandlerResult handle_iq_dummy(LmMessageHandler *h, LmConnection *c, + LmMessage *m, gpointer ud) +{ + LmMessageSubType mstype = lm_message_get_sub_type(m); + if (mstype == LM_MESSAGE_SUB_TYPE_ERROR) { + display_server_error(lm_message_node_get_child(m->node, "error")); + } + return LM_HANDLER_RESULT_REMOVE_MESSAGE; +} + static LmHandlerResult handle_iq_commands_list(LmMessageHandler *h, LmConnection *c, LmMessage *m, gpointer ud) @@ -560,11 +571,9 @@ int need_refresh = FALSE; guint roster_type; - for (y = lm_message_node_find_child(lm_message_node_find_xmlns - (m->node, NS_ROSTER), - "item"); - y; - y = y->next) { + y = lm_message_node_find_child(lm_message_node_find_xmlns(m->node, NS_ROSTER), + "item"); + for ( ; y; y = y->next) { char *name_tmp = NULL; fjid = lm_message_node_get_attribute(y, "jid");
--- a/mcabber/mcabber/xmpp_iq.h Sun Feb 07 17:34:00 2010 +0100 +++ b/mcabber/mcabber/xmpp_iq.h Sun Feb 07 19:13:33 2010 +0100 @@ -1,6 +1,9 @@ #ifndef __MCABBER_XMPP_IQ_H__ #define __MCABBER_XMPP_IQ_H__ 1 +LmHandlerResult handle_iq_dummy(LmMessageHandler *h, + LmConnection *c, + LmMessage *m, gpointer ud); LmHandlerResult handle_iq_commands(LmMessageHandler *h, LmConnection *c, LmMessage *m, gpointer ud);