Software /
code /
prosody
Changeset
4268:c249f10eb9bb
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(-)
author | Glenn Maynard <glenn@zewt.org> |
---|---|
date | Fri, 27 May 2011 17:04:43 +0100 |
parents | 4267:29d7eb6ff62c |
children | 4269:cd4011af8b4c |
files | plugins/mod_register.lua |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_register.lua Mon May 16 19:33:02 2011 +0100 +++ b/plugins/mod_register.lua Fri May 27 17:04:43 2011 +0100 @@ -22,6 +22,18 @@ 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;