Changeset

665:09e0e9c722a3

Add allow_registration option to disable account registration
author Matthew Wild <mwild1@gmail.com>
date Mon, 29 Dec 2008 23:36:24 +0000
parents 664:30ccc5e3d8c8
children 666:27f76695f43b
files plugins/mod_register.lua
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);
+