Add allow_registration option to disable account registration

Mon, 29 Dec 2008 23:36:24 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 29 Dec 2008 23:36:24 +0000
changeset 665
09e0e9c722a3
parent 664
30ccc5e3d8c8
child 666
27f76695f43b

Add allow_registration option to disable account registration

plugins/mod_register.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_register.lua	Mon Dec 29 22:31:10 2008 +0000
+++ b/plugins/mod_register.lua	Mon Dec 29 23:36:24 2008 +0000
@@ -94,7 +94,9 @@
 end);
 
 module:add_iq_handler("c2s_unauthed", "jabber:iq:register", function (session, stanza)
-	if stanza.tags[1].name == "query" then
+	if config.get(module.host, "core", "allow_registration") == false then
+		session.send(st.error_reply(stanza, "cancel", "service-unavailable"));
+	elseif stanza.tags[1].name == "query" then
 		local query = stanza.tags[1];
 		if stanza.attr.type == "get" then
 			local reply = st.reply(stanza);
@@ -132,3 +134,4 @@
 		session.send(st.error_reply(stanza, "cancel", "service-unavailable"));
 	end;
 end);
+

mercurial