aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_register.lua
diff options
context:
space:
mode:
authorGlenn Maynard <glenn@zewt.org>2011-05-27 17:04:43 +0100
committerGlenn Maynard <glenn@zewt.org>2011-05-27 17:04:43 +0100
commit49d51d062d8d71a29b08a0db972ed80e10c77f6d (patch)
treee739406d7afd774f60fcd752a862aba4734c3836 /plugins/mod_register.lua
parentdb55e7da51e3c6a654407010fd51833b99a45b2e (diff)
downloadprosody-49d51d062d8d71a29b08a0db972ed80e10c77f6d.tar.gz
prosody-49d51d062d8d71a29b08a0db972ed80e10c77f6d.zip
Advertise in-band registration support.
Implement optional registration support advertisement according to XEP-0077 sec8: <features> <register xmlns='http://jabber.org/features/iq-register'/> </features> --- plugins/mod_register.lua | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
Diffstat (limited to 'plugins/mod_register.lua')
-rw-r--r--plugins/mod_register.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua
index 25c09dfa..b4683b58 100644
--- a/plugins/mod_register.lua
+++ b/plugins/mod_register.lua
@@ -22,6 +22,18 @@ local compat = module:get_option_boolean("registration_compat", true);
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 module:get_option("allow_registration") == false 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;