Software /
code /
prosody
Diff
plugins/mod_register.lua @ 3995:e504b06492c6
mod_register: Add registration_compat config option to allow account remove requests addressed to='host' (defaults to true)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 04 Jan 2011 17:15:47 +0000 |
parent | 3540:bc139431830b |
child | 3996:7f35b292531b |
line wrap: on
line diff
--- a/plugins/mod_register.lua Tue Jan 04 17:12:28 2011 +0000 +++ b/plugins/mod_register.lua Tue Jan 04 17:15:47 2011 +0000 @@ -15,10 +15,13 @@ 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 @@ 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");