Software /
code /
prosody
Comparison
plugins/muc/muc.lib.lua @ 9023:ce461a67d2cc
MUC: Fix to send status code 100 *only* to the joining (fixes #680)
What does `if can_see_real_jids(whois, occupant) then` do?
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 12 Jul 2018 01:50:06 +0200 |
parent | 9022:293ebfed71f7 |
child | 9024:43241e74bb19 |
comparison
equal
deleted
inserted
replaced
9022:293ebfed71f7 | 9023:ce461a67d2cc |
---|---|
267 end | 267 end |
268 return anon_p, anon_x; | 268 return anon_p, anon_x; |
269 end | 269 end |
270 | 270 |
271 local self_p, self_x; | 271 local self_p, self_x; |
272 if can_see_real_jids(whois, occupant) then | 272 do |
273 self_p, self_x = get_full_p(); | |
274 else | |
275 -- Can always see your own full jids | 273 -- Can always see your own full jids |
276 -- But not allowed to see actor's | 274 -- But not allowed to see actor's |
277 self_x = st.clone(x.self or base_x); | 275 self_x = st.clone(x.self or base_x); |
278 self:build_item_list(occupant, self_x, false, nick, actor_nick, nil, reason); | 276 self:build_item_list(occupant, self_x, false, nick, actor_nick, nil, reason); |
279 self_p = st.clone(base_presence):add_child(self_x); | 277 self_p = st.clone(base_presence):add_child(self_x); |
601 end | 599 end |
602 end | 600 end |
603 | 601 |
604 if dest_occupant ~= nil then | 602 if dest_occupant ~= nil then |
605 dest_occupant:set_session(real_jid, stanza); | 603 dest_occupant:set_session(real_jid, stanza); |
606 local dest_x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";}); | |
607 if orig_occupant == nil and self:get_whois() == "anyone" then | |
608 dest_x:tag("status", {code = "100"}):up(); | |
609 end | |
610 self:save_occupant(dest_occupant); | 604 self:save_occupant(dest_occupant); |
611 | 605 |
612 if orig_occupant == nil or muc_x then | 606 if orig_occupant == nil or muc_x then |
613 -- Send occupant list to newly joined or desynced user | 607 -- Send occupant list to newly joined or desynced user |
614 self:send_occupant_list(real_jid, function(nick, occupant) -- luacheck: ignore 212 | 608 self:send_occupant_list(real_jid, function(nick, occupant) -- luacheck: ignore 212 |
615 -- Don't include self | 609 -- Don't include self |
616 return occupant:get_presence(real_jid) == nil; | 610 return occupant:get_presence(real_jid) == nil; |
617 end) | 611 end) |
618 end | 612 end |
619 local self_x; | 613 local dest_x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";}); |
614 local self_x = st.clone(dest_x); | |
615 if orig_occupant == nil and self:get_whois() == "anyone" then | |
616 self_x:tag("status", {code = "100"}):up(); | |
617 end | |
620 if nick_changed then | 618 if nick_changed then |
621 self_x = st.clone(dest_x); | |
622 self_x:tag("status", {code="210"}):up(); | 619 self_x:tag("status", {code="210"}):up(); |
623 end | 620 end |
624 self:publicise_occupant_status(dest_occupant, {base=dest_x,self=self_x}); | 621 self:publicise_occupant_status(dest_occupant, {base=dest_x,self=self_x}); |
625 | 622 |
626 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 | 623 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 |