plugins/muc/muc.lib.lua
changeset 6250 454ef19e7925
parent 6249 2420e308f64a
child 6252 10b27981ea3f
equal deleted inserted replaced
6249:2420e308f64a 6250:454ef19e7925
    98 	if old_occupant then
    98 	if old_occupant then
    99 		for real_jid in pairs(old_occupant.sessions) do
    99 		for real_jid in pairs(old_occupant.sessions) do
   100 			self._jid_nick[real_jid] = nil;
   100 			self._jid_nick[real_jid] = nil;
   101 		end
   101 		end
   102 	end
   102 	end
   103 	if occupant.role ~= nil and next(occupant.sessions) then
   103 
       
   104 	local has_live_session = false
       
   105 	if occupant.role ~= nil then
   104 		for real_jid, presence in occupant:each_session() do
   106 		for real_jid, presence in occupant:each_session() do
   105 			self._jid_nick[real_jid] = occupant.nick;
   107 			if presence.attr.type == nil then
   106 		end
   108 				has_live_session = true
   107 	else
   109 				self._jid_nick[real_jid] = occupant.nick;
       
   110 			end
       
   111 		end
       
   112 		if not has_live_session then
       
   113 			-- Has no live sessions left; they have left the room.
       
   114 			occupant.role = nil
       
   115 		end
       
   116 	end
       
   117 	if not has_live_session then
   108 		occupant = nil
   118 		occupant = nil
   109 	end
   119 	end
   110 	self._occupants[id] = occupant
   120 	self._occupants[id] = occupant
   111 end
   121 end
   112 
   122