MUC: Only send status code 110 (entering non-anonymous room) to the occupant themselves, not to other occupants.
authorWaqas Hussain <waqas20@gmail.com>
Wed, 10 Nov 2010 06:27:35 +0500
changeset 3593 58a4af582eb3
parent 3592 3adac5780c5a
child 3594 d3b57562cd87
MUC: Only send status code 110 (entering non-anonymous room) to the occupant themselves, not to other occupants.
plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Wed Nov 10 05:49:04 2010 +0500
+++ b/plugins/muc/muc.lib.lua	Wed Nov 10 06:27:35 2010 +0500
@@ -449,14 +449,17 @@
 						self._jid_nick[from] = to;
 						self:send_occupant_list(from);
 						pr.attr.from = to;
+						pr:tag("x", {xmlns='http://jabber.org/protocol/muc#user'})
+							:tag("item", {affiliation=affiliation or "none", role=role or "none"}):up();
 						if not is_merge then
-							self:broadcast_presence(pr, from);
-						else
-							pr.attr.to = from;
-							self:_route_stanza(pr:tag("x", {xmlns='http://jabber.org/protocol/muc#user'})
-								:tag("item", {affiliation=affiliation or "none", role=role or "none"}):up()
-								:tag("status", {code='110'}));
+							self:broadcast_except_nick(pr, to);
 						end
+						pr:tag("status", {code='110'});
+						if self._data.whois == 'anyone' then
+							pr:tag("status", {code='100'}):up();
+						end
+						pr.attr.to = from;
+						self:_route_stanza(pr);
 						self:send_history(from, stanza);
 					elseif not affiliation then -- registration required for entering members-only room
 						local reply = st.error_reply(stanza, "auth", "registration-required"):up();
@@ -1021,9 +1024,6 @@
 				end
 			end
 		end
-		if self._data.whois == 'anyone' then
-			muc_child:tag('status', { code = '100' }):up();
-		end
 	end
 	self:route_stanza(stanza);
 	if muc_child then