Only reply with errors if the stanza is not an error or a result (don't know how...
authorMatthew Wild <mwild1@gmail.com>
Fri, 14 Nov 2008 18:46:00 +0000 (18:46 +0000)
committerMatthew Wild <mwild1@gmail.com>
Fri, 14 Nov 2008 18:46:00 +0000 (18:46 +0000)
core/stanza_router.lua

index 16e6598f63becb9d1e9f9ada23ac2c65c5cbb471..c1819651422d5d1fe4571a4a41aabc7bb9d1c335 100644 (file)
@@ -174,16 +174,22 @@ function core_handle_stanza(origin, stanza)
                                stanza.attr.to = nil; -- reset it
                        else
                                log("warn", "Unhandled c2s presence: %s", tostring(stanza));
-                               origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+                               if stanza.attr.type ~= "error" then
+                                       origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+                               end
                        end
                else
                        log("warn", "Unhandled c2s stanza: %s", tostring(stanza));
-                       origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+                       if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
+                               origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+                       end
                end -- TODO handle other stanzas
        else
                log("warn", "Unhandled origin: %s", origin.type);
-               -- s2s stanzas can get here
-               (origin.sends2s or origin.send)(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+               if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
+                       -- s2s stanzas can get here
+                       (origin.sends2s or origin.send)(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+               end
        end
 end