if not is_first_dest_session then -- User is swapping into another pre-existing session
log("debug", "session %s is swapping into multisession %s, showing it leave.", real_jid, dest_occupant.nick);
-- Show the other session leaving
- local x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";})
- :tag("status"):text("you are joining pre-existing session " .. dest_nick):up();
+ local x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";});
add_item(x, self:get_affiliation(bare_jid), "none");
local pr = st.presence{from = dest_occupant.nick, to = real_jid, type = "unavailable"}
+ :tag("status"):text("you are joining pre-existing session " .. dest_nick):up()
:add_child(x);
self:route_stanza(pr);
end
end
self:save_occupant(dest_occupant);
- if orig_occupant == nil then
+ if orig_occupant == nil or muc_x then
-- Send occupant list to newly joined user
self:send_occupant_list(real_jid, function(nick, occupant) -- luacheck: ignore 212
-- Don't include self
self:route_stanza(pr);
end
- if orig_occupant == nil then
+ if orig_occupant == nil or muc_x then
if is_first_dest_session then
module:fire_event("muc-occupant-joined", {
room = self;
-- You need to be at least an admin, and be requesting info about your affifiliation or lower
-- e.g. an admin can't ask for a list of owners
local affiliation_rank = valid_affiliations[affiliation or "none"];
- if affiliation_rank >= valid_affiliations.admin and affiliation_rank >= _aff_rank then
+ if affiliation_rank >= valid_affiliations.admin and affiliation_rank >= _aff_rank
+ or self:get_members_only() and self:get_whois() == "anyone" and affiliation_rank >= valid_affiliations.member then
local reply = st.reply(stanza):query("http://jabber.org/protocol/muc#admin");
for jid in self:each_affiliation(_aff or "none") do
reply:tag("item", {affiliation = _aff, jid = jid}):up();