From b1743dfea11540cdf60fa26b560318f4a4b4fe84 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Sun, 29 Nov 2009 22:02:21 +0100 Subject: mod_compression: Prepare activating of compression on s2s. --- plugins/mod_compression.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index 096ed0d5..72573b93 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -8,7 +8,6 @@ local st = require "util.stanza"; local zlib = require "zlib"; local pcall = pcall; - local xmlns_compression_feature = "http://jabber.org/features/compress" local xmlns_compression_protocol = "http://jabber.org/protocol/compress" local xmlns_stream = "http://etherx.jabber.org/streams"; @@ -55,7 +54,7 @@ module:hook_stanza(xmlns_stream, "features", for a in comp_st:children() do local algorithm = a[1] if algorithm == "zlib" then - session.sends2s(st.stanza("compress", {xmlns=xmlns_compression_protocol}):text("zlib")) + session.sends2s(st.stanza("compress", {xmlns=xmlns_compression_protocol}):tag("method"):text("zlib")) session.log("info", "Enabled compression using zlib.") return true; end @@ -67,6 +66,12 @@ module:hook_stanza(xmlns_stream, "features", , 250); -- TODO Support compression on S2S level too. +module:add_handler({"s2sout_unauthed", "s2sout"}, "compressed", xmlns_compression_protocol, + function(session ,stanza) + session.log("debug", "Activating compression...") + end +); + module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress", xmlns_compression_protocol, function(session, stanza) -- fail if we are already compressed -- cgit v1.2.3