mod_s2s, mod_saslauth, mod_compression: Refactor to have common code for opening streams

This commit is contained in:
Kim Alvefur 2013-03-16 17:46:43 +01:00
parent c9d9694da0
commit ee9ef878c4
4 changed files with 28 additions and 22 deletions

View file

@ -141,10 +141,7 @@ module:hook("stanza/http://jabber.org/protocol/compress:compressed", function(ev
-- setup decompression for session.data
setup_decompression(session, inflate_stream);
session:reset_stream();
local default_stream_attr = {xmlns = "jabber:server", ["xmlns:stream"] = "http://etherx.jabber.org/streams",
["xmlns:db"] = 'jabber:server:dialback', version = "1.0", to = session.to_host, from = session.from_host};
session.sends2s("<?xml version='1.0'?>");
session.sends2s(st.stanza("stream:stream", default_stream_attr):top_tag());
session:open_stream();
session.compressed = true;
return true;
end