Software /
code /
prosody
Comparison
plugins/mod_legacyauth.lua @ 2610:c9ed79940b2e
mod_legacyauth: Hook stream-features event using new events API.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 12 Feb 2010 04:22:01 +0500 |
parent | 1912:126401a7159f |
child | 2925:692b3c6c5bd2 |
comparison
equal
deleted
inserted
replaced
2609:2ee28cae530a | 2610:c9ed79940b2e |
---|---|
17 local usermanager = require "core.usermanager"; | 17 local usermanager = require "core.usermanager"; |
18 local nodeprep = require "util.encodings".stringprep.nodeprep; | 18 local nodeprep = require "util.encodings".stringprep.nodeprep; |
19 local resourceprep = require "util.encodings".stringprep.resourceprep; | 19 local resourceprep = require "util.encodings".stringprep.resourceprep; |
20 | 20 |
21 module:add_feature("jabber:iq:auth"); | 21 module:add_feature("jabber:iq:auth"); |
22 module:add_event_hook("stream-features", function (session, features) | 22 module:hook("stream-features", function(event) |
23 if secure_auth_only and not session.secure then | 23 local origin, features = event.origin, event.features; |
24 if secure_auth_only and not origin.secure then | |
24 -- Sorry, not offering to insecure streams! | 25 -- Sorry, not offering to insecure streams! |
25 return; | 26 return; |
26 elseif not session.username then | 27 elseif not origin.username then |
27 features:tag("auth", {xmlns='http://jabber.org/features/iq-auth'}):up(); | 28 features:tag("auth", {xmlns='http://jabber.org/features/iq-auth'}):up(); |
28 end | 29 end |
29 end); | 30 end); |
30 | 31 |
31 module:add_iq_handler("c2s_unauthed", "jabber:iq:auth", | 32 module:add_iq_handler("c2s_unauthed", "jabber:iq:auth", |