Comparison

plugins/muc/muc.lib.lua @ 11235:1dba335eacea 0.11

MUC: Fix logic bug causing unnecessary presence to be sent, fixes #1615 (thanks damencho)
author Matthew Wild <mwild1@gmail.com>
date Tue, 15 Dec 2020 13:36:08 +0000
parent 11142:552cafd30eb2
child 11236:b1d7027be61e
child 11712:d117b92fd8e4
comparison
equal deleted inserted replaced
11226:b3ae48362f78 11235:1dba335eacea
1324 for occupant, old_role in pairs(occupants_updated) do 1324 for occupant, old_role in pairs(occupants_updated) do
1325 self:publicise_occupant_status(occupant, x, nil, actor, reason); 1325 self:publicise_occupant_status(occupant, x, nil, actor, reason);
1326 if occupant.role == nil then 1326 if occupant.role == nil then
1327 module:fire_event("muc-occupant-left", {room = self; nick = occupant.nick; occupant = occupant;}); 1327 module:fire_event("muc-occupant-left", {room = self; nick = occupant.nick; occupant = occupant;});
1328 elseif is_semi_anonymous and 1328 elseif is_semi_anonymous and
1329 (old_role == "moderator" and occupant.role ~= "moderator") or 1329 ((old_role == "moderator" and occupant.role ~= "moderator") or
1330 (old_role ~= "moderator" and occupant.role == "moderator") then -- Has gained or lost moderator status 1330 (old_role ~= "moderator" and occupant.role == "moderator")) then -- Has gained or lost moderator status
1331 -- Send everyone else's presences (as jid visibility has changed) 1331 -- Send everyone else's presences (as jid visibility has changed)
1332 for real_jid in occupant:each_session() do 1332 for real_jid in occupant:each_session() do
1333 self:send_occupant_list(real_jid, function(occupant_jid, occupant) --luacheck: ignore 212 433 1333 self:send_occupant_list(real_jid, function(occupant_jid, occupant) --luacheck: ignore 212 433
1334 return occupant.bare_jid ~= jid; 1334 return occupant.bare_jid ~= jid;
1335 end); 1335 end);