mirror of
https://github.com/bjc/prosody.git
synced 2025-04-06 22:57:38 +03:00
mod_legacyauth: Hook stream-features event using new events API.
This commit is contained in:
parent
2d89cb62a3
commit
afea5e0f46
1 changed files with 4 additions and 3 deletions
|
@ -19,11 +19,12 @@ local nodeprep = require "util.encodings".stringprep.nodeprep;
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue