mod_legacyauth: Hook stream-features event using new events API.

Fri, 12 Feb 2010 04:22:01 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Fri, 12 Feb 2010 04:22:01 +0500
changeset 2610
c9ed79940b2e
parent 2609
2ee28cae530a
child 2611
c3ea4d3f857f

mod_legacyauth: Hook stream-features event using new events API.

plugins/mod_legacyauth.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_legacyauth.lua	Fri Feb 12 04:21:34 2010 +0500
+++ b/plugins/mod_legacyauth.lua	Fri Feb 12 04:22:01 2010 +0500
@@ -19,11 +19,12 @@
 local resourceprep = require "util.encodings".stringprep.resourceprep;
 
 module:add_feature("jabber:iq:auth");
-module:add_event_hook("stream-features", function (session, features)
-	if secure_auth_only and not session.secure then
+module:hook("stream-features", function(event)
+	local origin, features = event.origin, event.features;
+	if secure_auth_only and not origin.secure then
 		-- Sorry, not offering to insecure streams!
 		return;
-	elseif not session.username then
+	elseif not origin.username then
 		features:tag("auth", {xmlns='http://jabber.org/features/iq-auth'}):up();
 	end
 end);

mercurial