mod_muc: The default component name is now 'Chatrooms'
[prosody.git] / plugins / mod_bosh.lua
index 0b39d903284842bebaa651c39b044a52c1d2d34e..653af8bbdbfb419a5c2d7f6fca59fcc3b5a3a3f3 100644 (file)
@@ -1,6 +1,7 @@
 
 module.host = "*" -- Global module
 
+local hosts = _G.hosts;
 local lxp = require "lxp";
 local init_xmlhandlers = require "core.xmlhandlers"
 local server = require "net.server";
@@ -125,6 +126,7 @@ function stream_callbacks.streamopened(request, attr)
                -- TODO: Sanity checks here (rid, to, known host, etc.)
                if not hosts[attr.to] then
                        -- Unknown host
+                       log("debug", "BOSH client tried to connect to unknown host: %s", tostring(attr.to));
                        session_close_reply.attr.condition = "host-unknown";
                        request:send{ headers = default_headers, body = tostring(session_close_reply) };
                        request.notopen = nil
@@ -179,7 +181,7 @@ function stream_callbacks.streamopened(request, attr)
                --xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'
                local response = st.stanza("body", { xmlns = xmlns_bosh, 
                                                                        inactivity = tostring(BOSH_DEFAULT_INACTIVITY), polling = tostring(BOSH_DEFAULT_POLLING), requests = tostring(BOSH_DEFAULT_REQUESTS), hold = tostring(session.bosh_hold), maxpause = "120", 
-                                                                       sid = sid, ver  = '1.6', from = session.host, secure = 'true', ["xmpp:version"] = "1.0", 
+                                                                       sid = sid, authid = sid, ver  = '1.6', from = session.host, secure = 'true', ["xmpp:version"] = "1.0", 
                                                                        ["xmlns:xmpp"] = "urn:xmpp:xbosh", ["xmlns:stream"] = "http://etherx.jabber.org/streams" }):add_child(features);
                request:send{ headers = default_headers, body = tostring(response) };