diff options
author | Glenn Maynard <glenn@zewt.org> | 2011-05-27 17:04:43 +0100 |
---|---|---|
committer | Glenn Maynard <glenn@zewt.org> | 2011-05-27 17:04:43 +0100 |
commit | de414820e74e1d032725d2307af939521a399fbc (patch) | |
tree | e739406d7afd774f60fcd752a862aba4734c3836 /plugins/mod_register.lua | |
parent | dc7c12d028a40b72034a6b63d0c9e88c22631f5b (diff) | |
download | prosody-de414820e74e1d032725d2307af939521a399fbc.tar.gz prosody-de414820e74e1d032725d2307af939521a399fbc.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.lua | 12 |
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; |