# HG changeset patch # User Kim Alvefur # Date 1463258197 -7200 # Node ID 3a90e9732204c46c3199e9bbb6dcc3b4101a374c # Parent 0bb98138dacf22eb3048bd1130862e296b576d16 Backed out changeset 63141a85beea, broke multi-session nicks diff -r 0bb98138dacf -r 3a90e9732204 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Thu May 12 18:45:59 2016 +0100 +++ b/plugins/muc/muc.lib.lua Sat May 14 22:36:37 2016 +0200 @@ -446,7 +446,6 @@ function room_mt:handle_normal_presence(origin, stanza) local type = stanza.attr.type; - local muc_x = stanza:get_child("x", "http://jabber.org/protocol/muc"); local real_jid = stanza.attr.from; local bare_jid = jid_bare(real_jid); local orig_occupant = self:get_occupant_by_real_jid(real_jid); @@ -456,18 +455,13 @@ if type == "unavailable" then -- luacheck: ignore 542 -- FIXME Why the empty if branch? -- dest_occupant = nil - elseif orig_occupant and not muc_x and orig_occupant.nick == stanza.attr.to then -- Just a presence update + elseif orig_occupant and orig_occupant.nick == stanza.attr.to then -- Just a presence update log("debug", "presence update for %s from session %s", orig_occupant.nick, real_jid); dest_occupant = orig_occupant; else local dest_jid = stanza.attr.to; dest_occupant = self:get_occupant_by_nick(dest_jid); - if muc_x then - dest_occupant = self:new_occupant(bare_jid, dest_jid); - if dest_occupant == nil then - is_first_dest_session = true; - end - elseif dest_occupant == nil then + if dest_occupant == nil then log("debug", "no occupant found for %s; creating new occupant object for %s", dest_jid, real_jid); is_first_dest_session = true; dest_occupant = self:new_occupant(bare_jid, dest_jid); @@ -483,6 +477,7 @@ end -- TODO Handle these cases sensibly + local muc_x = stanza:get_child("x", "http://jabber.org/protocol/muc"); if orig_occupant == nil and not muc_x then module:log("debug", "Join without , possibly desynced"); elseif orig_occupant ~= nil and muc_x then