local jid = require "util.jid"; --- Finds and returns room by its jid -- @param room_jid the room jid to search in the muc component -- @return returns room if found or nil function get_room_from_jid(room_jid) local _, host = jid.split(room_jid); local component = hosts[host]; if component then local muc = component.modules.muc if muc and rawget(muc,"rooms") then -- We're running 0.9.x or 0.10 (old MUC API) return muc.rooms[room_jid]; elseif muc and rawget(muc,"get_room_from_jid") then -- We're running >0.10 (new MUC API) return muc.get_room_from_jid(room_jid); else return end end end return { get_room_from_jid = get_room_from_jid; };