diff -r ccebb2720741 -r 4c0dcd245d34 core/stanza_router.lua --- a/core/stanza_router.lua Fri Oct 24 06:13:38 2008 +0100 +++ b/core/stanza_router.lua Fri Oct 24 07:27:36 2008 +0100 @@ -26,7 +26,7 @@ if stanza.name == "iq" and not(#stanza.tags == 1 and stanza.tags[1].attr.xmlns) then if stanza.attr.type == "set" or stanza.attr.type == "get" then error("Invalid IQ"); - elseif #stanza.tags > 1 or not(stanza.attr.type == "error" or stanza.attr.type == "result") then + elseif #stanza.tags > 1 and not(stanza.attr.type == "error" or stanza.attr.type == "result") then error("Invalid IQ"); end end @@ -49,10 +49,8 @@ core_handle_stanza(origin, stanza); elseif stanza.name == "iq" and not select(3, jid_split(to)) then core_handle_stanza(origin, stanza); - elseif origin.type == "c2s" then + elseif origin.type == "c2s" or origin.type == "s2sin" then core_route_stanza(origin, stanza); - elseif origin.type == "s2sin" then - core_deliver_stanza(origin, stanza); end end @@ -98,7 +96,7 @@ log("debug", "Routing stanza to local"); handle_stanza(session, stanza); end - elseif origin.type == "s2sin_unauthed" then + elseif origin.type == "s2sin_unauthed" or origin.type == "s2sin" then if stanza.attr.xmlns == "jabber:server:dialback" then if stanza.name == "verify" then -- We are being asked to verify the key, to ensure it was generated by us @@ -113,7 +111,8 @@ type = "valid" end origin.send(format("%s", attr.to, attr.from, attr.id, type, stanza[1])); - elseif stanza.name == "result" then + elseif stanza.name == "result" and origin.type == "s2sin_unauthed" then + -- he wants to be identified through dialback -- We need to check the key with the Authoritative server local attr = stanza.attr; origin.from_host = attr.from; @@ -244,22 +243,18 @@ end end end - else + elseif origin.type == "c2s" then -- Remote host + --stanza.attr.xmlns = "jabber:server"; + stanza.attr.xmlns = nil; log("debug", "sending s2s stanza: %s", tostring(stanza)); - stanza.attr.xmlns = "jabber:server"; send_s2s(origin.host, host, stanza); + else + log("warn", "received stanza from unhandled connection type: %s", origin.type); end stanza.attr.to = to; -- reset end -function core_deliver_stanza(origin, stanza) - local name, attr = stanza.name, stanza.attr; - if name == "message" then - - end -end - function handle_stanza_toremote(stanza) log("error", "Stanza bound for remote host, but s2s is not implemented"); end