Software /
code /
prosody
Changeset
5763:0e52f1d5ca71
mod_register: Use more specific get_option variants
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 02 Aug 2013 14:44:56 +0200 |
parents | 5762:785da1854eb9 |
children | 5764:969e0a054795 |
files | plugins/mod_register.lua |
diffstat | 1 files changed, 4 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_register.lua Wed Jul 24 23:30:32 2013 +0200 +++ b/plugins/mod_register.lua Fri Aug 02 14:44:56 2013 +0200 @@ -170,13 +170,10 @@ 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;