# HG changeset patch # User Matthew Wild # Date 1636992663 0 # Node ID ba3344926e180e7236e23c09352d78cf50630242 # Parent bbfa707a47565682364595b8aa938c9f1e743d45 MUC: Add option to include form in registration query This was originally not done based on my interpretation of XEP-0045. Today's reading, however, revealed that it actually says the result > SHOULD contain **at least** a element (emphasis mine) I take this to mean that including a form **is** allowed (and I think this is sensible). Tigase already includes the form I believe. I've gated the new behaviour behind a (default off) option, because it hasn't been tested for compatibility with clients. My primary desire for it is in Snikket, where the clients will be tested to ensure compatibility with this. I don't anticipate that (m)any clients would break, so maybe after 0.12 we can experiment with enabling it by default and eventually remove the option. diff -r bbfa707a4756 -r ba3344926e18 plugins/muc/register.lib.lua --- a/plugins/muc/register.lib.lua Mon Nov 15 13:31:06 2021 +0100 +++ b/plugins/muc/register.lib.lua Mon Nov 15 16:11:03 2021 +0000 @@ -8,6 +8,10 @@ local enforce_nick = module:get_option_boolean("enforce_registered_nickname", false); +-- Whether to include the current registration data as a dataform. Disabled +-- by default currently as it hasn't been widely tested with clients. +local include_reg_form = module:get_option_boolean("muc_registration_include_form", false); + -- reserved_nicks[nick] = jid local function get_reserved_nicks(room) if room._reserved_nicks then @@ -128,10 +132,14 @@ if stanza.attr.type == "get" then reply:query("jabber:iq:register"); if registered_nick then - -- I find it strange, but XEP-0045 says not to include - -- the current registration data (only the registered name) reply:tag("registered"):up(); - reply:tag("username"):text(registered_nick); + reply:tag("username"):text(registered_nick):up(); + if include_reg_form then + local aff_data = room:get_affiliation_data(user_jid); + if aff_data then + reply:add_child(registration_form:form(aff_data, "result")); + end + end origin.send(reply); return true; end