From 49d51d062d8d71a29b08a0db972ed80e10c77f6d Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 27 May 2011 17:04:43 +0100 Subject: Advertise in-band registration support. Implement optional registration support advertisement according to XEP-0077 sec8: --- plugins/mod_register.lua | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) --- plugins/mod_register.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'plugins') 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; -- cgit v1.2.3