aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-03-28 20:28:20 -0400
committerdaurnimator <quae@daurnimator.com>2014-03-28 20:28:20 -0400
commita3d3e9267405dbb9e81078366bf949e604748c78 (patch)
treeed9db2c23448958a6c0e10b72c77a0381a715e6e
parent84060786506a2a3180dce7ae57beebe7e651d7c7 (diff)
downloadprosody-a3d3e9267405dbb9e81078366bf949e604748c78.tar.gz
prosody-a3d3e9267405dbb9e81078366bf949e604748c78.zip
plugins/muc/muc.lib: Use occupant methods where possible
-rw-r--r--plugins/muc/muc.lib.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 7704a099..684539bd 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -641,7 +641,7 @@ module:hook("muc-occupant-joined", function(event)
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 @@ function room_mt:handle_presence_to_occupant(origin, stanza)
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 = {