diff plugins/muc/register.lib.lua @ 9298:2d71040a959f

MUC: If a user with an existing affiliation registers, preserve that affiliation (thanks jc)
author Matthew Wild <mwild1@gmail.com>
date Thu, 13 Sep 2018 14:46:24 +0100
parents 37b7cf3470f1
children 9bdd9b6bf362 4e406944ff85
line wrap: on
line diff
--- a/plugins/muc/register.lib.lua	Wed Sep 12 14:59:52 2018 +0100
+++ b/plugins/muc/register.lib.lua	Thu Sep 13 14:46:24 2018 +0100
@@ -174,7 +174,7 @@
 		-- Checks passed, save the registration
 		if registered_nick ~= desired_nick then
 			local registration_data = { reserved_nickname = desired_nick };
-			local ok, err_type, err_condition = room:set_affiliation(true, user_jid, "member", nil, registration_data);
+			local ok, err_type, err_condition = room:set_affiliation(true, user_jid, affiliation or "member", nil, registration_data);
 			if not ok then
 				origin.send(st.error_reply(stanza, err_type, err_condition));
 				return true;