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(-)
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;