Software / code / prosody
Comparison
plugins/mod_compression.lua @ 2291:c6bed51c6733
mod_compression: Some comment clean up.
| author | Tobias Markmann <tm@ayena.de> |
|---|---|
| date | Tue, 01 Dec 2009 20:59:42 +0100 |
| parent | 2289:8938265695c9 |
| child | 2292:9c5941198719 |
comparison
equal
deleted
inserted
replaced
| 2290:ef7027a0f0c9 | 2291:c6bed51c6733 |
|---|---|
| 42 features:add_child(compression_stream_feature); | 42 features:add_child(compression_stream_feature); |
| 43 end | 43 end |
| 44 end | 44 end |
| 45 ); | 45 ); |
| 46 | 46 |
| 47 -- S2Sout handling aka the client perspective in the S2S connection | 47 -- Hook to activate compression if remote server supports it. |
| 48 module:hook_stanza(xmlns_stream, "features", | 48 module:hook_stanza(xmlns_stream, "features", |
| 49 function (session, stanza) | 49 function (session, stanza) |
| 50 if not session.compressed then | 50 if not session.compressed then |
| 51 -- does remote server support compression? | 51 -- does remote server support compression? |
| 52 local comp_st = stanza:child_with_name("compression"); | 52 local comp_st = stanza:child_with_name("compression"); |
| 133 end | 133 end |
| 134 old_data(conn, decompressed); | 134 old_data(conn, decompressed); |
| 135 end; | 135 end; |
| 136 end | 136 end |
| 137 | 137 |
| 138 -- TODO Support compression on S2S level too. | |
| 139 module:add_handler({"s2sout_unauthed", "s2sout"}, "compressed", xmlns_compression_protocol, | 138 module:add_handler({"s2sout_unauthed", "s2sout"}, "compressed", xmlns_compression_protocol, |
| 140 function(session ,stanza) | 139 function(session ,stanza) |
| 141 session.log("debug", "Activating compression...") | 140 session.log("debug", "Activating compression...") |
| 142 -- create deflate and inflate streams | 141 -- create deflate and inflate streams |
| 143 deflate_stream = get_deflate_stream(session); | 142 deflate_stream = get_deflate_stream(session); |