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); |