# HG changeset patch
# User Waqas Hussain <waqas20@gmail.com>
# Date 1265930494 -18000
# Node ID 2ee28cae530aaa539d8d31152bc0f7722fedea3f
# Parent  68c43aaf681f14c3eebd56b6f2edb1341bfb350f
mod_compression: Hook stream-features event using new events API.

diff -r 68c43aaf681f -r 2ee28cae530a plugins/mod_compression.lua
--- 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",