Merge 0.7->0.8
[prosody.git] / plugins / mod_register.lua
index 8a818d027ca0f71c7a2f95770a22af5f8f530d2d..25c09dfa69a2c0013bd5e474a04ccb50348c7913 100644 (file)
@@ -19,22 +19,9 @@ local nodeprep = require "util.encodings".stringprep.nodeprep;
 local jid_bare = require "util.jid".bare;
 
 local compat = module:get_option_boolean("registration_compat", true);
-local allow_registration = module:get_option_boolean("allow_registration", false);
 
 module:add_feature("jabber:iq:register");
 
-local register_stream_feature = st.stanza("register", {xmlns="http://jabber.org/features/iq-register"}):up();
-module:hook("stream-features", function(event)
-        local session, features = event.origin, event.features;
-
-       -- Advertise registration to unauthorized clients only.
-       if not(allow_registration) or session.type ~= "c2s_unauthed" then
-               return
-       end
-
-       features:add_child(register_stream_feature);
-end);
-
 local function handle_registration_stanza(event)
        local session, stanza = event.origin, event.stanza;
 
@@ -127,7 +114,7 @@ for _, ip in ipairs(blacklisted_ips) do blacklisted_ips[ip] = true; end
 module:hook("stanza/iq/jabber:iq:register:query", function(event)
        local session, stanza = event.origin, event.stanza;
 
-       if not(allow_registration) or session.type ~= "c2s_unauthed" then
+       if module:get_option("allow_registration") == false or session.type ~= "c2s_unauthed" then
                session.send(st.error_reply(stanza, "cancel", "service-unavailable"));
        else
                local query = stanza.tags[1];