Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/xmpp.c @ 1647:cfa1fff86f78
Reorder processing in handle_iq()
There's no need to call the get/set handler functions if we receive an error
IQ message.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Wed, 04 Nov 2009 22:24:05 +0100 |
parents | 472cd6ac20fa |
children | fca9a4c17432 8effa82ae593 |
comparison
equal
deleted
inserted
replaced
1646:472cd6ac20fa | 1647:cfa1fff86f78 |
---|---|
1411 guint dbgflg; | 1411 guint dbgflg; |
1412 const char *xmlns = NULL; | 1412 const char *xmlns = NULL; |
1413 LmMessageNode *x; | 1413 LmMessageNode *x; |
1414 LmMessageSubType mstype = lm_message_get_sub_type(m); | 1414 LmMessageSubType mstype = lm_message_get_sub_type(m); |
1415 | 1415 |
1416 if (mstype == LM_MESSAGE_SUB_TYPE_ERROR) { | |
1417 display_server_error(lm_message_node_get_child(m->node, "error")); | |
1418 return LM_HANDLER_RESULT_REMOVE_MESSAGE; | |
1419 } | |
1420 | |
1416 for (x = m->node->children; x; x=x->next) { | 1421 for (x = m->node->children; x; x=x->next) { |
1417 xmlns = lm_message_node_get_attribute(x, "xmlns"); | 1422 xmlns = lm_message_node_get_attribute(x, "xmlns"); |
1418 if (xmlns) | 1423 if (xmlns) |
1419 for (i=0; iq_handlers[i].xmlns; ++i) | 1424 for (i=0; iq_handlers[i].xmlns; ++i) |
1420 if (!strcmp(iq_handlers[i].xmlns, xmlns)) | 1425 if (!strcmp(iq_handlers[i].xmlns, xmlns)) |
1421 return iq_handlers[i].handler(NULL, connection, m, user_data); | 1426 return iq_handlers[i].handler(NULL, connection, m, user_data); |
1422 xmlns = NULL; | 1427 xmlns = NULL; |
1423 } | |
1424 | |
1425 if (mstype == LM_MESSAGE_SUB_TYPE_ERROR) { | |
1426 display_server_error(lm_message_node_get_child(m->node, "error")); | |
1427 return LM_HANDLER_RESULT_REMOVE_MESSAGE; | |
1428 } | 1428 } |
1429 | 1429 |
1430 if ((mstype == LM_MESSAGE_SUB_TYPE_SET) || | 1430 if ((mstype == LM_MESSAGE_SUB_TYPE_SET) || |
1431 (mstype == LM_MESSAGE_SUB_TYPE_GET)) | 1431 (mstype == LM_MESSAGE_SUB_TYPE_GET)) |
1432 send_iq_error(connection, m, XMPP_ERROR_NOT_IMPLEMENTED); | 1432 send_iq_error(connection, m, XMPP_ERROR_NOT_IMPLEMENTED); |