Software /
code /
prosody
Diff
plugins/mod_compression.lua @ 2609:2ee28cae530a
mod_compression: Hook stream-features event using new events API.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 12 Feb 2010 04:21:34 +0500 |
parent | 2324:9f7eb1054a2f |
child | 2613:afa20941e098 |
line wrap: on
line diff
--- a/plugins/mod_compression.lua Fri Feb 12 04:11:50 2010 +0500 +++ b/plugins/mod_compression.lua Fri Feb 12 04:21:34 2010 +0500 @@ -25,24 +25,21 @@ return; end -module:add_event_hook("stream-features", - function (session, features) - if not session.compressed then - -- FIXME only advertise compression support when TLS layer has no compression enabled - features:add_child(compression_stream_feature); - end - end -); +module:hook("stream-features", function(event) + local origin, features = event.origin, event.features; + if not origin.compressed then + -- FIXME only advertise compression support when TLS layer has no compression enabled + features:add_child(compression_stream_feature); + end +end); -module:hook("s2s-stream-features", - function (data) - local session, features = data.session, data.features; - -- FIXME only advertise compression support when TLS layer has no compression enabled - if not session.compressed then - features:add_child(compression_stream_feature); - end - end -); +module:hook("s2s-stream-features", function(event) + local session, features = event.session, event.features; + -- FIXME only advertise compression support when TLS layer has no compression enabled + if not session.compressed then + features:add_child(compression_stream_feature); + end +end); -- Hook to activate compression if remote server supports it. module:hook_stanza(xmlns_stream, "features",