Comparison

plugins/mod_register.lua @ 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
parent 5707:36a289e9244c
child 5776:bd0ff8ae98a8
comparison
equal deleted inserted replaced
5762:785da1854eb9 5763:0e52f1d5ca71
168 return data; 168 return data;
169 end 169 end
170 end 170 end
171 171
172 local recent_ips = {}; 172 local recent_ips = {};
173 local min_seconds_between_registrations = module:get_option("min_seconds_between_registrations"); 173 local min_seconds_between_registrations = module:get_option_number("min_seconds_between_registrations");
174 local whitelist_only = module:get_option("whitelist_registration_only"); 174 local whitelist_only = module:get_option_boolean("whitelist_registration_only");
175 local whitelisted_ips = module:get_option("registration_whitelist") or { "127.0.0.1" }; 175 local whitelisted_ips = module:get_option_set("registration_whitelist", { "127.0.0.1" })._items;
176 local blacklisted_ips = module:get_option("registration_blacklist") or {}; 176 local blacklisted_ips = module:get_option_set("registration_blacklist", {})._items;
177
178 for _, ip in ipairs(whitelisted_ips) do whitelisted_ips[ip] = true; end
179 for _, ip in ipairs(blacklisted_ips) do blacklisted_ips[ip] = true; end
180 177
181 module:hook("stanza/iq/jabber:iq:register:query", function(event) 178 module:hook("stanza/iq/jabber:iq:register:query", function(event)
182 local session, stanza = event.origin, event.stanza; 179 local session, stanza = event.origin, event.stanza;
183 180
184 if not(allow_registration) or session.type ~= "c2s_unauthed" then 181 if not(allow_registration) or session.type ~= "c2s_unauthed" then