mod_saslauth_muc/mod_saslauth_muc.lua
changeset 3076 926db29176f5
parent 1426 249c5447fed1
equal deleted inserted replaced
3075:b6cac9d72255 3076:926db29176f5
    32 local function remove_handler_for(room, jid) if _rooms[room] then _rooms[room][jid] = nil; end end
    32 local function remove_handler_for(room, jid) if _rooms[room] then _rooms[room][jid] = nil; end end
    33 local function create_handler_for(room_jid, jid)
    33 local function create_handler_for(room_jid, jid)
    34 	_rooms[room_jid] = _rooms[room_jid] or {};
    34 	_rooms[room_jid] = _rooms[room_jid] or {};
    35 	_rooms[room_jid][jid] = new_sasl(module.host, { plain = function(sasl, username, realm)
    35 	_rooms[room_jid][jid] = new_sasl(module.host, { plain = function(sasl, username, realm)
    36 		local muc = hosts[module.host].modules.muc;
    36 		local muc = hosts[module.host].modules.muc;
    37 		local room = muc and muc.get_room_by_jid(room_jid);
    37 		local room = muc and muc.get_room_from_jid(room_jid);
    38 		local password = room and muc_password.get(room);
    38 		local password = room and muc_password.get(room);
    39 		local ret = password and true or nil;
    39 		local ret = password and true or nil;
    40 		return password or "", ret;
    40 		return password or "", ret;
    41 	end });
    41 	end });
    42 	_rooms[room_jid][jid].timeout = os_time() + timeout;
    42 	_rooms[room_jid][jid].timeout = os_time() + timeout;