aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-01-04 17:15:47 +0000
committerMatthew Wild <mwild1@gmail.com>2011-01-04 17:15:47 +0000
commit07a2dfbb1ea35dbb6f4c857b8a84406e09dc2432 (patch)
treeaf3e5cee1c46d74a2667170e5bbd92602e78ca6a /plugins
parent90562d1b6e7db93c5e2379959416809d98c89d4a (diff)
downloadprosody-07a2dfbb1ea35dbb6f4c857b8a84406e09dc2432.tar.gz
prosody-07a2dfbb1ea35dbb6f4c857b8a84406e09dc2432.zip
mod_register: Add registration_compat config option to allow account remove requests addressed to='host' (defaults to true)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_register.lua17
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua
index 1df73297..abbb7c94 100644
--- a/plugins/mod_register.lua
+++ b/plugins/mod_register.lua
@@ -15,10 +15,13 @@ local usermanager_create_user = require "core.usermanager".create_user;
local usermanager_set_password = require "core.usermanager".set_password;
local os_time = os.time;
local nodeprep = require "util.encodings".stringprep.nodeprep;
+local jid_bare = require "util.jid".bare;
+
+local compat = module:get_option_boolean("registration_compat", true);
module:add_feature("jabber:iq:register");
-module:hook("iq/self/jabber:iq:register:query", function(event)
+local function handle_registration_stanza(event)
local session, stanza = event.origin, event.stanza;
local query = stanza.tags[1];
@@ -86,7 +89,17 @@ module:hook("iq/self/jabber:iq:register:query", function(event)
end
end
return true;
-end);
+end
+
+module:hook("iq/self/jabber:iq:register:query", handle_registration_stanza);
+if compat then
+ module:hook("iq/host/jabber:iq:register:query", function (event)
+ local session, stanza = event.origin, event.stanza;
+ if session.type == "c2s" and jid_bare(stanza.attr.to) == session.host then
+ return handle_registration_stanza(event);
+ end
+ end);
+end
local recent_ips = {};
local min_seconds_between_registrations = module:get_option("min_seconds_between_registrations");