Allow replies to non-iq stanzas. [#22]
This changes so that any stanza type will check if there is a reply handler
waiting for the incoming ID. When implementing for example XEP-0184 (Message
Receipts) there will be returned message stanzas that needs to be given to a
reply handler.
committer: Mikael Hallendal <micke@imendio.com>
--- a/loudmouth/lm-connection.c Mon Oct 06 11:31:46 2008 +0200
+++ b/loudmouth/lm-connection.c Mon Oct 06 22:00:49 2008 +0200
@@ -266,24 +266,21 @@
goto out;
}
- if ((lm_message_get_sub_type (m) == LM_MESSAGE_SUB_TYPE_ERROR) ||
- (lm_message_get_sub_type (m) == LM_MESSAGE_SUB_TYPE_RESULT)) {
- id = lm_message_node_get_attribute (m->node, "id");
+ id = lm_message_node_get_attribute (m->node, "id");
- if (id) {
- handler = g_hash_table_lookup (connection->id_handlers, id);
- if (handler) {
- result = _lm_message_handler_handle_message (handler,
- connection,
- m);
- g_hash_table_remove (connection->id_handlers,
- id);
- }
+ if (id) {
+ handler = g_hash_table_lookup (connection->id_handlers, id);
+ if (handler) {
+ result = _lm_message_handler_handle_message (handler,
+ connection,
+ m);
+ g_hash_table_remove (connection->id_handlers,
+ id);
}
+ }
- if (result == LM_HANDLER_RESULT_REMOVE_MESSAGE) {
- goto out;
- }
+ if (result == LM_HANDLER_RESULT_REMOVE_MESSAGE) {
+ goto out;
}
for (l = connection->handlers[lm_message_get_type (m)];