MUC: Fix logic bug causing unnecessary presence to be sent, fixes #1615 (thanks damencho) 0.11
authorMatthew Wild <mwild1@gmail.com>
Tue, 15 Dec 2020 13:36:08 +0000
branch0.11
changeset 11239 1dba335eacea
parent 11230 b3ae48362f78
child 11240 b1d7027be61e
child 11241 49aeae836ad1
MUC: Fix logic bug causing unnecessary presence to be sent, fixes #1615 (thanks damencho)
plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Thu Dec 10 11:53:10 2020 +0100
+++ b/plugins/muc/muc.lib.lua	Tue Dec 15 13:36:08 2020 +0000
@@ -1326,8 +1326,8 @@
 			if occupant.role == nil then
 				module:fire_event("muc-occupant-left", {room = self; nick = occupant.nick; occupant = occupant;});
 			elseif is_semi_anonymous and
-				(old_role == "moderator" and occupant.role ~= "moderator") or
-				(old_role ~= "moderator" and occupant.role == "moderator") then -- Has gained or lost moderator status
+				((old_role == "moderator" and occupant.role ~= "moderator") or
+				(old_role ~= "moderator" and occupant.role == "moderator")) then -- Has gained or lost moderator status
 				-- Send everyone else's presences (as jid visibility has changed)
 				for real_jid in occupant:each_session() do
 					self:send_occupant_list(real_jid, function(occupant_jid, occupant) --luacheck: ignore 212 433