# HG changeset patch # User Matthew Wild # Date 1239229245 -3600 # Node ID dd736391bd41b3a9039031811b23d94800ec22c9 # Parent 5516f9e66482d9e86d9d2692aeadef9aa8f11128# Parent 9ab6934fb1ff73e7ae1e8ce0df750b0ced04ee0d Merge diff -r 9ab6934fb1ff -r dd736391bd41 core/componentmanager.lua --- a/core/componentmanager.lua Wed Apr 08 21:14:48 2009 +0100 +++ b/core/componentmanager.lua Wed Apr 08 23:20:45 2009 +0100 @@ -73,9 +73,9 @@ end function create_component(host, component) - -- TODO check for host well-formedness - local session = session or { type = "component", host = host, connected = true, s2sout = {}, send = component }; - return session; + -- TODO check for host well-formedness + local session = session or { type = "component", host = host, connected = true, s2sout = {}, send = component }; + return session; end function register_component(host, component, session) diff -r 9ab6934fb1ff -r dd736391bd41 core/sessionmanager.lua --- a/core/sessionmanager.lua Wed Apr 08 21:14:48 2009 +0100 +++ b/core/sessionmanager.lua Wed Apr 08 23:20:45 2009 +0100 @@ -155,31 +155,29 @@ end function streamopened(session, attr) - local send = session.send; - session.host = attr.to or error("Client failed to specify destination hostname"); - session.host = nameprep(session.host); - session.version = tonumber(attr.version) or 0; - session.streamid = m_random(1000000, 99999999); - (session.log or session)("debug", "Client sent opening to %s", session.host); - - - send(""); - send(format("", session.streamid, session.host)); + local send = session.send; + session.host = attr.to or error("Client failed to specify destination hostname"); + session.host = nameprep(session.host); + session.version = tonumber(attr.version) or 0; + session.streamid = m_random(1000000, 99999999); + (session.log or session)("debug", "Client sent opening to %s", session.host); + + send(""); + send(format("", session.streamid, session.host)); + + if not hosts[session.host] then + -- We don't serve this host... + session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; + return; + end - if not hosts[session.host] then - -- We don't serve this host... - session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; - return; - end - - - local features = st.stanza("stream:features"); - fire_event("stream-features", session, features); - - send(features); - - (session.log or log)("info", "Sent reply to client"); - session.notopen = nil; + local features = st.stanza("stream:features"); + fire_event("stream-features", session, features); + + send(features); + + (session.log or log)("info", "Sent reply to client"); + session.notopen = nil; end function streamclosed(session)