# HG changeset patch # User Seve Ferrer # Date 1608038171 -3600 # Node ID bcb2b9adfcde64297eea4a396336efdc7beb9804 # Parent 3f3b672b7616d2a8a8158e0d3ff6518177afbece mod_muc_http_auth: Use get_option_set API properly diff -r 3f3b672b7616 -r bcb2b9adfcde mod_muc_http_auth/mod_muc_http_auth.lua --- 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)