aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_saslauth.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-02-12 04:25:37 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-02-12 04:25:37 +0500
commit98da04140180b77125ad1fdecb0d47f30c9d30fb (patch)
tree57a16e389b1e202129f6c8103ea62002a8dd2df8 /plugins/mod_saslauth.lua
parent025cbd545c519e9c46e74f05bf3d58d30d6d403d (diff)
downloadprosody-98da04140180b77125ad1fdecb0d47f30c9d30fb.tar.gz
prosody-98da04140180b77125ad1fdecb0d47f30c9d30fb.zip
mod_saslauth: Hook stream-features event using new events API.
Diffstat (limited to 'plugins/mod_saslauth.lua')
-rw-r--r--plugins/mod_saslauth.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 75ee9f04..beb59dd2 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -144,21 +144,22 @@ module:add_handler("c2s_unauthed", "response", xmlns_sasl, sasl_handler);
local mechanisms_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-sasl' };
local bind_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-bind' };
local xmpp_session_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-session' };
-module:add_event_hook("stream-features", function(session, features)
- if not session.username then
- if secure_auth_only and not session.secure then
+module:hook("stream-features", function(event)
+ local origin, features = event.origin, event.features;
+ if not origin.username then
+ if secure_auth_only and not origin.secure then
return;
end
if module:get_option("anonymous_login") then
- session.sasl_handler = new_sasl(session.host, anonymous_authentication_profile);
+ origin.sasl_handler = new_sasl(origin.host, anonymous_authentication_profile);
else
- session.sasl_handler = new_sasl(session.host, default_authentication_profile);
- if not (module:get_option("allow_unencrypted_plain_auth")) and not session.secure then
- session.sasl_handler:forbidden({"PLAIN"});
+ origin.sasl_handler = new_sasl(origin.host, default_authentication_profile);
+ if not (module:get_option("allow_unencrypted_plain_auth")) and not origin.secure then
+ origin.sasl_handler:forbidden({"PLAIN"});
end
end
features:tag("mechanisms", mechanisms_attr);
- for k, v in pairs(session.sasl_handler:mechanisms()) do
+ for k, v in pairs(origin.sasl_handler:mechanisms()) do
features:tag("mechanism"):text(v):up();
end
features:up();