Diff

plugins/muc/muc.lib.lua @ 6192:f97aa1f4b1f1

plugins/muc/muc.lib: Use occupant methods where possible
author daurnimator <quae@daurnimator.com>
date Fri, 28 Mar 2014 20:28:20 -0400
parent 6191:5956f4e69ab2
child 6193:b9074126639f
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Fri Mar 28 20:25:10 2014 -0400
+++ b/plugins/muc/muc.lib.lua	Fri Mar 28 20:28:20 2014 -0400
@@ -641,7 +641,7 @@
 	local real_jid = stanza.attr.from;
 	room:send_occupant_list(real_jid, function(nick, occupant)
 		-- Don't include self
-		return occupant.sessions[real_jid] == nil
+		return occupant:get_presence(real_jid) == nil;
 	end);
 	room:send_history(stanza);
 	room:send_subject(real_jid);
@@ -687,7 +687,8 @@
 		local is_last_orig_session;
 		if orig_occupant ~= nil then
 			-- Is there are least 2 sessions?
-			is_last_orig_session = next(orig_occupant.sessions, next(orig_occupant.sessions)) == nil;
+			local iter, ob, last = orig_occupant:each_session();
+			is_last_orig_session = iter(ob, iter(ob, last)) == nil;
 		end
 
 		local event, event_name = {