Comparison

plugins/muc/muc.lib.lua @ 6252:10b27981ea3f

plugins/muc/muc: Only set role to nil if it's the last session to leave
author daurnimator <quae@daurnimator.com>
date Wed, 21 May 2014 13:11:00 -0400
parent 6250:454ef19e7925
child 6253:2df9e7a67e56
comparison
equal deleted inserted replaced
6251:41a5e5205fd9 6252:10b27981ea3f
408 if orig_occupant ~= nil and orig_occupant ~= dest_occupant then 408 if orig_occupant ~= nil and orig_occupant ~= dest_occupant then
409 local orig_x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";}); 409 local orig_x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";});
410 local dest_nick; 410 local dest_nick;
411 if dest_occupant == nil then -- Session is leaving 411 if dest_occupant == nil then -- Session is leaving
412 log("debug", "session %s is leaving occupant %s", real_jid, orig_occupant.nick); 412 log("debug", "session %s is leaving occupant %s", real_jid, orig_occupant.nick);
413 orig_occupant.role = nil; 413 if is_last_orig_session then
414 orig_occupant.role = nil;
415 end
414 orig_occupant:set_session(real_jid, stanza); 416 orig_occupant:set_session(real_jid, stanza);
415 else 417 else
416 log("debug", "session %s is changing from occupant %s to %s", real_jid, orig_occupant.nick, dest_occupant.nick); 418 log("debug", "session %s is changing from occupant %s to %s", real_jid, orig_occupant.nick, dest_occupant.nick);
417 local generated_unavail = st.presence {from = orig_occupant.nick, to = real_jid, type = "unavailable"}; 419 local generated_unavail = st.presence {from = orig_occupant.nick, to = real_jid, type = "unavailable"};
418 orig_occupant:set_session(real_jid, generated_unavail); 420 orig_occupant:set_session(real_jid, generated_unavail);