Mercurial > prosody-hg
comparison 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 |
| parents | 5956f4e69ab2 |
| children | b9074126639f |
comparison
equal
deleted
inserted
replaced
| 6191:5956f4e69ab2 | 6192:f97aa1f4b1f1 |
|---|---|
| 639 module:hook("muc-occupant-joined", function(event) | 639 module:hook("muc-occupant-joined", function(event) |
| 640 local room, stanza = event.room, event.stanza; | 640 local room, stanza = event.room, event.stanza; |
| 641 local real_jid = stanza.attr.from; | 641 local real_jid = stanza.attr.from; |
| 642 room:send_occupant_list(real_jid, function(nick, occupant) | 642 room:send_occupant_list(real_jid, function(nick, occupant) |
| 643 -- Don't include self | 643 -- Don't include self |
| 644 return occupant.sessions[real_jid] == nil | 644 return occupant:get_presence(real_jid) == nil; |
| 645 end); | 645 end); |
| 646 room:send_history(stanza); | 646 room:send_history(stanza); |
| 647 room:send_subject(real_jid); | 647 room:send_subject(real_jid); |
| 648 end, -1); | 648 end, -1); |
| 649 | 649 |
| 685 end | 685 end |
| 686 end | 686 end |
| 687 local is_last_orig_session; | 687 local is_last_orig_session; |
| 688 if orig_occupant ~= nil then | 688 if orig_occupant ~= nil then |
| 689 -- Is there are least 2 sessions? | 689 -- Is there are least 2 sessions? |
| 690 is_last_orig_session = next(orig_occupant.sessions, next(orig_occupant.sessions)) == nil; | 690 local iter, ob, last = orig_occupant:each_session(); |
| 691 is_last_orig_session = iter(ob, iter(ob, last)) == nil; | |
| 691 end | 692 end |
| 692 | 693 |
| 693 local event, event_name = { | 694 local event, event_name = { |
| 694 room = self; | 695 room = self; |
| 695 origin = origin; | 696 origin = origin; |
