Software /
code /
prosody
Comparison
plugins/muc/muc.lib.lua @ 1826:de165b5de254
MUC: Added multi-session support to the room-exiting occupant use case.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 25 Sep 2009 12:39:28 +0500 |
parent | 1825:f67e4bfc62f1 |
child | 1862:115f274dd17f |
comparison
equal
deleted
inserted
replaced
1825:f67e4bfc62f1 | 1826:de165b5de254 |
---|---|
213 :tag('status'):text('This participant is kicked from the room because he sent an error presence')); -- send unavailable | 213 :tag('status'):text('This participant is kicked from the room because he sent an error presence')); -- send unavailable |
214 end | 214 end |
215 elseif type == "unavailable" then -- unavailable | 215 elseif type == "unavailable" then -- unavailable |
216 if current_nick then | 216 if current_nick then |
217 log("debug", "%s leaving %s", current_nick, room); | 217 log("debug", "%s leaving %s", current_nick, room); |
218 local data = self._occupants[current_nick]; | 218 local occupant = self._occupants[current_nick]; |
219 data.role = 'none'; | 219 local old_session = occupant.sessions[from]; |
220 self:broadcast_presence(pr); | 220 local new_jid = next(occupant.sessions); |
221 self._occupants[current_nick] = nil; | 221 if new_jid == from then new_jid = next(occupant.sessions, new_jid); end |
222 if new_jid then | |
223 occupant.jid = new_jid; | |
224 occupant.sessions[from] = nil; | |
225 local pr = st.clone(occupant[new_jid]) | |
226 :tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) | |
227 :tag("item", {affiliation=occupant.affiliation, role=occupant.role}); | |
228 self:broadcast_except_nick(pr, current_nick); | |
229 else | |
230 occupant.role = 'none'; | |
231 self:broadcast_presence(pr); | |
232 self._occupants[current_nick] = nil; | |
233 end | |
222 self._jid_nick[from] = nil; | 234 self._jid_nick[from] = nil; |
223 end | 235 end |
224 elseif not type then -- available | 236 elseif not type then -- available |
225 if current_nick then | 237 if current_nick then |
226 --if #pr == #stanza or current_nick ~= to then -- commented because google keeps resending directed presence | 238 --if #pr == #stanza or current_nick ~= to then -- commented because google keeps resending directed presence |