Refine "Allow replies to non-iq stanzas"
authorFrank Zschockelt <lm@freakysoft.de>
Wed, 10 Feb 2010 11:59:07 +0100
changeset 613 174c17adc1e7
parent 612 70ab966760fd
child 614 773201ca404c
Refine "Allow replies to non-iq stanzas" (c8e0edc96a65cc29abc8fd6eeb9dc8a62d12f0f1) The old check was useful for iq-stanzas, because otherwise iq requests to yourself will break. Therefore replies to iq-stanzas should only be forwarded to the id-handlers if it is a result or error sub type.
loudmouth/lm-connection.c
--- a/loudmouth/lm-connection.c	Sun Jan 17 11:47:05 2010 +0100
+++ b/loudmouth/lm-connection.c	Wed Feb 10 11:59:07 2010 +0100
@@ -343,9 +343,13 @@
         goto out;
     }
 
-    result = connection_run_message_handler (connection, m);
-    if (result == LM_HANDLER_RESULT_REMOVE_MESSAGE) {
-        goto out;
+    if ((lm_message_get_type (m) != LM_MESSAGE_TYPE_IQ) ||
+        (lm_message_get_sub_type (m) == LM_MESSAGE_SUB_TYPE_ERROR) ||
+        (lm_message_get_sub_type (m) == LM_MESSAGE_SUB_TYPE_RESULT)) {
+        result = connection_run_message_handler (connection, m);
+        if (result == LM_HANDLER_RESULT_REMOVE_MESSAGE) {
+            goto out;
+        }
     }
 
     for (l = connection->handlers[lm_message_get_type (m)];