Software /
code /
prosody
Changeset
2282:6f54dac3ec2d
mod_compression: Prepare activating of compression on s2s.
author | Tobias Markmann <tm@ayena.de> |
---|---|
date | Sun, 29 Nov 2009 22:02:21 +0100 |
parents | 2281:27441b099984 |
children | 2283:156bb00ba5c0 |
files | plugins/mod_compression.lua |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_compression.lua Sun Nov 29 21:33:37 2009 +0100 +++ b/plugins/mod_compression.lua Sun Nov 29 22:02:21 2009 +0100 @@ -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 @@ 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 @@ , 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