Changeset

9023:ce461a67d2cc

MUC: Fix to send status code 100 *only* to the joining (fixes #680) What does `if can_see_real_jids(whois, occupant) then` do?
author Kim Alvefur <zash@zash.se>
date Thu, 12 Jul 2018 01:50:06 +0200
parents 9022:293ebfed71f7
children 9024:43241e74bb19
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Thu Jul 12 01:23:19 2018 +0200
+++ b/plugins/muc/muc.lib.lua	Thu Jul 12 01:50:06 2018 +0200
@@ -269,9 +269,7 @@
 	end
 
 	local self_p, self_x;
-	if can_see_real_jids(whois, occupant) then
-		self_p, self_x = get_full_p();
-	else
+	do
 		-- Can always see your own full jids
 		-- But not allowed to see actor's
 		self_x = st.clone(x.self or base_x);
@@ -603,10 +601,6 @@
 
 	if dest_occupant ~= nil then
 		dest_occupant:set_session(real_jid, stanza);
-		local dest_x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";});
-		if orig_occupant == nil and self:get_whois() == "anyone" then
-			dest_x:tag("status", {code = "100"}):up();
-		end
 		self:save_occupant(dest_occupant);
 
 		if orig_occupant == nil or muc_x then
@@ -616,9 +610,12 @@
 				return occupant:get_presence(real_jid) == nil;
 			end)
 		end
-		local self_x;
+		local dest_x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";});
+		local self_x = st.clone(dest_x);
+		if orig_occupant == nil and self:get_whois() == "anyone" then
+			self_x:tag("status", {code = "100"}):up();
+		end
 		if nick_changed then
-			self_x = st.clone(dest_x);
 			self_x:tag("status", {code="210"}):up();
 		end
 		self:publicise_occupant_status(dest_occupant, {base=dest_x,self=self_x});