aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-08-02 14:44:56 +0200
committerKim Alvefur <zash@zash.se>2013-08-02 14:44:56 +0200
commit74c8b94006f33a24a922d8e5885bee417baf2213 (patch)
treeb4feb16c045e50f9dac3b0a15d591389c0b2ae0b
parentb32d55cb777c9530a6a98a9b011023ad5c69b0c5 (diff)
downloadprosody-74c8b94006f33a24a922d8e5885bee417baf2213.tar.gz
prosody-74c8b94006f33a24a922d8e5885bee417baf2213.zip
mod_register: Use more specific get_option variants
-rw-r--r--plugins/mod_register.lua11
1 files changed, 4 insertions, 7 deletions
diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua
index 3cdb48b3..5b03c480 100644
--- a/plugins/mod_register.lua
+++ b/plugins/mod_register.lua
@@ -170,13 +170,10 @@ local function parse_response(query)
end
local recent_ips = {};
-local min_seconds_between_registrations = module:get_option("min_seconds_between_registrations");
-local whitelist_only = module:get_option("whitelist_registration_only");
-local whitelisted_ips = module:get_option("registration_whitelist") or { "127.0.0.1" };
-local blacklisted_ips = module:get_option("registration_blacklist") or {};
-
-for _, ip in ipairs(whitelisted_ips) do whitelisted_ips[ip] = true; end
-for _, ip in ipairs(blacklisted_ips) do blacklisted_ips[ip] = true; end
+local min_seconds_between_registrations = module:get_option_number("min_seconds_between_registrations");
+local whitelist_only = module:get_option_boolean("whitelist_registration_only");
+local whitelisted_ips = module:get_option_set("registration_whitelist", { "127.0.0.1" })._items;
+local blacklisted_ips = module:get_option_set("registration_blacklist", {})._items;
module:hook("stanza/iq/jabber:iq:register:query", function(event)
local session, stanza = event.origin, event.stanza;