aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/s2s
diff options
context:
space:
mode:
authorFlorian Zeitz <florob@babelmonkeys.de>2012-02-24 15:21:21 +0000
committerFlorian Zeitz <florob@babelmonkeys.de>2012-02-24 15:21:21 +0000
commiteda5f26eb482f9f74949248f0fd9bd60e4f5580d (patch)
tree897982a2f4f426148c21c11c5c1a82d903d6dcf7 /plugins/s2s
parent24bfbf5ce26959ffcd466ce43c69a07adaa4c81b (diff)
downloadprosody-eda5f26eb482f9f74949248f0fd9bd60e4f5580d.tar.gz
prosody-eda5f26eb482f9f74949248f0fd9bd60e4f5580d.zip
mod_s2s: port functionality once in s2smanager.
Diffstat (limited to 'plugins/s2s')
-rw-r--r--plugins/s2s/mod_s2s.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/s2s/mod_s2s.lua b/plugins/s2s/mod_s2s.lua
index 5be4d84b..0de821b2 100644
--- a/plugins/s2s/mod_s2s.lua
+++ b/plugins/s2s/mod_s2s.lua
@@ -14,10 +14,12 @@ local xpcall, traceback = xpcall, debug.traceback;
local add_task = require "util.timer".add_task;
local st = require "util.stanza";
local initialize_filters = require "util.filters".initialize;
+local nameprep = require "util.encodings".stringprep.nameprep;
local new_xmpp_stream = require "util.xmppstream".new;
local s2s_new_incoming = require "core.s2smanager".new_incoming;
local s2s_new_outgoing = require "core.s2smanager".new_outgoing;
local s2s_destroy_session = require "core.s2smanager".destroy_session;
+local uuid_gen = require "util.uuid".generate;
local s2sout = module:require("s2sout");
@@ -94,6 +96,7 @@ function send_to_host(from_host, to_host, stanza)
host_session.bounce_sendq = bounce_sendq;
host_session.sendq = { {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)} };
log("debug", "stanza [%s] queued until connection complete", tostring(stanza.name));
+ s2sout.initiate_connection(host_session);
if (not host_session.connecting) and (not host_session.conn) then
log("warn", "Connection to %s failed already, destroying session...", to_host);
if not s2s_destroy_session(host_session, "Connection failed") then
@@ -102,7 +105,6 @@ function send_to_host(from_host, to_host, stanza)
end
return false;
end
- s2sout.initiate_connection(host_session);
end
return true;
end
@@ -189,7 +191,7 @@ function stream_callbacks.streamopened(session, attr)
if session.secure and not session.cert_chain_status then check_cert_status(session); end
send("<?xml version='1.0'?>");
- send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback',
+ send(stanza.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, to=session.from_host, version=(session.version > 0 and "1.0" or nil) }):top_tag());
if session.version >= 1.0 then
local features = st.stanza("stream:features");
@@ -235,6 +237,7 @@ function stream_callbacks.streamopened(session, attr)
end
end
session.notopen = nil;
+ session.send = function(stanza) send_to_host(session.to_host, session.from_host, stanza); end;
end
function stream_callbacks.streamclosed(session)