Software /
code /
prosody-modules
Changeset
4301:bcb2b9adfcde
mod_muc_http_auth: Use get_option_set API properly
author | Seve Ferrer <seve@delape.net> |
---|---|
date | Tue, 15 Dec 2020 14:16:11 +0100 |
parents | 4300:3f3b672b7616 |
children | 4302:c9e1eee6a948 |
files | mod_muc_http_auth/mod_muc_http_auth.lua |
diffstat | 1 files changed, 4 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_muc_http_auth/mod_muc_http_auth.lua Tue Dec 15 10:49:11 2020 +0000 +++ b/mod_muc_http_auth/mod_muc_http_auth.lua Tue Dec 15 14:16:11 2020 +0100 @@ -12,26 +12,12 @@ local authorize_registration = module:get_option("muc_http_auth_authorize_registration", false) local function must_be_authorized(room_node) - -- If none of these is set, all rooms need authorization + -- If none or both of these are set, all rooms need authorization if not enabled_for and not disabled_for then return true; end + if enabled_for and disabled_for then return true; end - if enabled_for and not disabled_for then - for _, _room_node in ipairs(enabled_for) do - if _room_node == room_node then - return true; - end - end - end - - if disabled_for and not enabled_for then - for _, _room_node in ipairs(disabled_for) do - if _room_node == room_node then - return false; - end - end - end - - return true; + if enabled_for then return enabled_for:contains(room_node); end + if disabled_for then return not disabled_for:contains(room_node); end end local function handle_success(response)