comparison plugins/mod_muc.lua @ 1141:9d9570516ce8

mod_muc: commented connection replace detection code because google keeps resendng directed presence
author Waqas Hussain <waqas20@gmail.com>
date Fri, 08 May 2009 04:41:18 +0500
parents 76bd1bd14234
children b58ff7ed5676
comparison
equal deleted inserted replaced
1140:76bd1bd14234 1141:9d9570516ce8
258 rooms:remove(room, current_nick); 258 rooms:remove(room, current_nick);
259 jid_nick:remove(from, room); 259 jid_nick:remove(from, room);
260 end 260 end
261 elseif not type then -- available 261 elseif not type then -- available
262 if current_nick then 262 if current_nick then
263 if #pr == #stanza or current_nick ~= to then 263 --if #pr == #stanza or current_nick ~= to then -- commented because google keeps resending directed presence
264 if current_nick == to then -- simple presence 264 if current_nick == to then -- simple presence
265 log("debug", "%s broadcasted presence", current_nick); 265 log("debug", "%s broadcasted presence", current_nick);
266 rooms:get(room, current_nick).sessions[from] = pr; 266 rooms:get(room, current_nick).sessions[from] = pr;
267 broadcast_presence_stanza(room, pr); 267 broadcast_presence_stanza(room, pr);
268 else -- change nick 268 else -- change nick
285 else 285 else
286 --TODO malformed-jid 286 --TODO malformed-jid
287 end 287 end
288 end 288 end
289 end 289 end
290 else -- possible rejoin 290 --else -- possible rejoin
291 log("debug", "%s had connection replaced", current_nick); 291 -- log("debug", "%s had connection replaced", current_nick);
292 handle_to_occupant(origin, st.presence({type='unavailable', from=from, to=to}):tag('status'):text('Replaced by new connection'):up()); -- send unavailable 292 -- handle_to_occupant(origin, st.presence({type='unavailable', from=from, to=to}):tag('status'):text('Replaced by new connection'):up()); -- send unavailable
293 handle_to_occupant(origin, stanza); -- resend available 293 -- handle_to_occupant(origin, stanza); -- resend available
294 end 294 --end
295 else -- enter room 295 else -- enter room
296 local new_nick = to; 296 local new_nick = to;
297 if rooms:get(room, to) then 297 if rooms:get(room, to) then
298 new_nick = nil; 298 new_nick = nil;
299 end 299 end