Software /
code /
prosody
Diff
plugins/muc/muc.lib.lua @ 6231:bc12a8253f94
plugins/muc/muc.lib: Move sending of occupant list to joining user out of hook, and into main flow: It has to occur before publication of their status
author | daurnimator <quae@daurnimator.com> |
---|---|
date | Mon, 21 Apr 2014 17:51:32 -0400 |
parent | 6229:8aa59b73f801 |
child | 6232:d7dc71d9171d |
child | 6237:a58685df9d16 |
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua Mon Apr 21 17:49:57 2014 -0400 +++ b/plugins/muc/muc.lib.lua Mon Apr 21 17:51:32 2014 -0400 @@ -320,15 +320,6 @@ end end, -10); --- Send occupant list to newly joined user -module:hook("muc-occupant-joined", function(event) - local real_jid = event.stanza.attr.from; - event.room:send_occupant_list(real_jid, function(nick, occupant) - -- Don't include self - return occupant:get_presence(real_jid) == nil; - end); -end, 80); - function room_mt:handle_presence_to_occupant(origin, stanza) local type = stanza.attr.type; if type == "error" then -- error, kick em out! @@ -457,6 +448,14 @@ dest_x:tag("status", {code = "100"}):up(); end self:save_occupant(dest_occupant); + + if orig_occupant == nil and is_first_dest_session then + -- Send occupant list to newly joined user + self:send_occupant_list(real_jid, function(nick, occupant) + -- Don't include self + return occupant:get_presence(real_jid) == nil; + end) + end self:publicise_occupant_status(dest_occupant, dest_x); if orig_occupant ~= nil and orig_occupant ~= dest_occupant and not is_last_orig_session then -- If user is swapping and wasn't last original session