diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-02-12 04:21:34 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-02-12 04:21:34 +0500 |
commit | 2d89cb62a336f3ff58deede88781e4b7d14b298f (patch) | |
tree | 6d4b48ac8f4ab3fa673165080b2adf6cfddfeed9 /plugins | |
parent | ffc968aae4622a89f81ea204a5aa3f2373c5e5ab (diff) | |
download | prosody-2d89cb62a336f3ff58deede88781e4b7d14b298f.tar.gz prosody-2d89cb62a336f3ff58deede88781e4b7d14b298f.zip |
mod_compression: Hook stream-features event using new events API.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_compression.lua | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index 638b8e13..725c0b63 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -25,24 +25,21 @@ if not compression_level or compression_level < 1 or compression_level > 9 then 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", |