Reverted my change to modulemanager, to restore those made by waqas
[prosody.git] / core / s2smanager.lua
index 2370e437e365144f96eff6a1e74b124d984625ce..6d8f3a00b75d520992c4f8edc413c86bc4675637 100644 (file)
@@ -87,9 +87,7 @@ function new_outgoing(from_host, to_host)
                local cl = connlisteners_get("xmppserver");
                
                local conn, handler = socket.tcp()
-               
-               --FIXME: Below parameters (ports/ip) are incorrect (use SRV)
-               
+
                local connect_host, connect_port = to_host, 5269;
                
                local answer = dns.lookup("_xmpp-server._tcp."..to_host..".", "SRV");
@@ -105,7 +103,6 @@ function new_outgoing(from_host, to_host)
                        
                        local srv_choice = srv_hosts[1];
                        if srv_choice then
-                               log("debug", "Best record found");
                                connect_host, connect_port = srv_choice.target or to_host, srv_choice.port or connect_port;
                                log("debug", "Best record found, will connect to %s:%d", connect_host, connect_port);
                        end
@@ -144,21 +141,20 @@ function streamopened(session, attr)
        
        session.version = tonumber(attr.version) or 0;
        if session.version >= 1.0 and not (attr.to and attr.from) then
-               print("to: "..tostring(attr.to).." from: "..tostring(attr.from));
-               --error(session.to_host.." failed to specify 'to' or 'from' hostname as per RFC");
+               --print("to: "..tostring(attr.to).." from: "..tostring(attr.from));
                log("warn", (session.to_host or "(unknown)").." failed to specify 'to' or 'from' hostname as per RFC");
        end
        
        if session.direction == "incoming" then
                -- Send a reply stream header
                
-               for k,v in pairs(attr) do print("", tostring(k), ":::", tostring(v)); end
+               --for k,v in pairs(attr) do print("", tostring(k), ":::", tostring(v)); end
                
                session.to_host = attr.to;
                session.from_host = attr.from;
        
                session.streamid = uuid_gen();
-               print(session, session.from_host, "incoming s2s stream opened");
+               (session.log or log)("debug", "incoming s2s received <stream:stream>");
                send("<?xml version='1.0'?>");
                send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host }):top_tag());
                if session.to_host and not hosts[session.to_host] then
@@ -170,18 +166,6 @@ function streamopened(session, attr)
                        send(st.stanza("stream:features")
                                        :tag("dialback", { xmlns='urn:xmpp:features:dialback' }):tag("optional"):up():up());
                end
-               --[[
-               local features = {};
-               modulemanager.fire_event("stream-features-s2s", session, features);
-       
-               send("<stream:features>");
-       
-               for _, feature in ipairs(features) do
-                       send(tostring(feature));
-               end
-
-               send("</stream:features>");
-               ]]
        elseif session.direction == "outgoing" then
                -- If we are just using the connection for verifying dialback keys, we won't try and auth it
                if not attr.id then error("stream response did not give us a streamid!!!"); end