Merge 0.10->trunk
[prosody.git] / plugins / mod_component.lua
index 1497b12fc6a0096661aae5e1345cab9f25c4be52..53ef4ed028b79670606f218fb55605fb5f917cf6 100644 (file)
@@ -177,9 +177,7 @@ function stream_callbacks.streamopened(session, attr)
        session.streamid = uuid_gen();
        session.notopen = nil;
        -- Return stream header
-       session.send("<?xml version='1.0'?>");
-       session.send(st.stanza("stream:stream", { xmlns=xmlns_component,
-                       ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.host }):top_tag());
+       session:open_stream();
 end
 
 function stream_callbacks.streamclosed(session)
@@ -319,6 +317,10 @@ function listener.ondisconnect(conn, err)
        end
 end
 
+function listener.ondetach(conn)
+       sessions[conn] = nil;
+end
+
 module:provides("net", {
        name = "component";
        private = true;