207 self._participants[current_nick].sessions[from] = pr; |
207 self._participants[current_nick].sessions[from] = pr; |
208 room_broadcast_presence(self, pr); |
208 room_broadcast_presence(self, pr); |
209 else -- change nick |
209 else -- change nick |
210 if self._participants[to] then |
210 if self._participants[to] then |
211 log("debug", "%s couldn't change nick", current_nick); |
211 log("debug", "%s couldn't change nick", current_nick); |
212 origin.send(st.error_reply(stanza, "cancel", "conflict")); |
212 origin.send(st.error_reply(stanza, "cancel", "conflict"):tag("x", {xmlns = "http://jabber.org/protocol/muc"})); |
213 else |
213 else |
214 local data = self._participants[current_nick]; |
214 local data = self._participants[current_nick]; |
215 local to_nick = select(3, jid_split(to)); |
215 local to_nick = select(3, jid_split(to)); |
216 if to_nick then |
216 if to_nick then |
217 log("debug", "%s (%s) changing nick to %s", current_nick, data.jid, to); |
217 log("debug", "%s (%s) changing nick to %s", current_nick, data.jid, to); |
238 if self._participants[to] then |
238 if self._participants[to] then |
239 new_nick = nil; |
239 new_nick = nil; |
240 end |
240 end |
241 if not new_nick then |
241 if not new_nick then |
242 log("debug", "%s couldn't join due to nick conflict: %s", from, to); |
242 log("debug", "%s couldn't join due to nick conflict: %s", from, to); |
243 origin.send(st.error_reply(stanza, "cancel", "conflict")); |
243 origin.send(st.error_reply(stanza, "cancel", "conflict"):tag("x", {xmlns = "http://jabber.org/protocol/muc"})); |
244 else |
244 else |
245 log("debug", "%s joining as %s", from, to); |
245 log("debug", "%s joining as %s", from, to); |
246 local data; |
246 local data; |
247 -- if not rooms:get(room) and not rooms_info:get(room) then -- new room |
247 -- if not rooms:get(room) and not rooms_info:get(room) then -- new room |
248 -- rooms_info:set(room, 'name', (jid_split(room))); |
248 -- rooms_info:set(room, 'name', (jid_split(room))); |