# HG changeset patch # User Kim Alvefur # Date 1520618630 -3600 # Node ID e9acb928c6374b5007a8d79d9627e25cc7133be9 # Parent 560419b759c897c79205c4c22ef4c8ee16ffcd1c MUC: Remove support for GC 1.0 for joining diff -r 560419b759c8 -r e9acb928c637 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Fri Mar 09 19:02:10 2018 +0100 +++ b/plugins/muc/muc.lib.lua Fri Mar 09 19:03:50 2018 +0100 @@ -470,6 +470,13 @@ local bare_jid = jid_bare(real_jid); local orig_occupant = self:get_occupant_by_real_jid(real_jid); local muc_x = stanza:get_child("x", "http://jabber.org/protocol/muc"); + + if orig_occupant == nil and not muc_x then + module:log("debug", "Attempted join without , possibly desynced"); + origin.send(st.error_reply(stanza, "cancel", "item-not-found", "You must join the room before sending presence updates")); + return true; + end + local is_first_dest_session; local dest_occupant; if type == "unavailable" then @@ -496,13 +503,6 @@ is_last_orig_session = iter(ob, iter(ob, last)) == nil; end - -- TODO Handle these cases sensibly - if orig_occupant == nil and not muc_x then - module:log("debug", "Join without , possibly desynced"); - elseif orig_occupant ~= nil and muc_x then - module:log("debug", "Presence update with , possibly desynced"); - end - local orig_nick = dest_occupant and dest_occupant.nick; local event, event_name = { @@ -604,7 +604,7 @@ self:save_occupant(dest_occupant); if orig_occupant == nil or muc_x then - -- Send occupant list to newly joined user + -- Send occupant list to newly joined or desynced user self:send_occupant_list(real_jid, function(nick, occupant) -- luacheck: ignore 212 -- Don't include self return occupant:get_presence(real_jid) == nil;