# HG changeset patch # User Matthew Wild # Date 1584023734 0 # Node ID ac3ec4f2b1240cf0a251697f3efa86cb38afdd30 # Parent 98f21a1557377dbc14ec0f590f2c44e9abf9b8be MUC: Pass previous role to :publicise_occupant_status() when destroying a MUC diff -r 98f21a155737 -r ac3ec4f2b124 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Thu Mar 12 14:13:22 2020 +0000 +++ b/plugins/muc/muc.lib.lua Thu Mar 12 14:35:34 2020 +0000 @@ -908,12 +908,13 @@ x = x or st.stanza("x", {xmlns='http://jabber.org/protocol/muc#user'}); local occupants_updated = {}; for nick, occupant in self:each_occupant() do -- luacheck: ignore 213 + local prev_role = occupant.role; occupant.role = nil; self:save_occupant(occupant); - occupants_updated[occupant] = true; + occupants_updated[occupant] = prev_role; end - for occupant in pairs(occupants_updated) do - self:publicise_occupant_status(occupant, x); + for occupant, prev_role in pairs(occupants_updated) do + self:publicise_occupant_status(occupant, x, nil, nil, nil, prev_role); module:fire_event("muc-occupant-left", { room = self; nick = occupant.nick;