Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Creates util for modules and adds method get_room_from_jid in it.
damencho2b1e8cdeffff
diff --git a/resources/prosody-plugins/mod_muc_size.lua b/resources/prosody-plugins/mod_muc_size.luaindex dfc9c7a655..d8d2716c55 100644--- a/resources/prosody-plugins/mod_muc_size.lua+++ b/resources/prosody-plugins/mod_muc_size.lua@@ -19,6 +19,7 @@ local enableTokenVerification= module:get_option_boolean("enable_roomsize_token_verification", false);local token_util = module:require "token/util".new(module);+local get_room_from_jid = module:require "util".get_room_from_jid;-- no token configuration but requiredif token_util == nil and enableTokenVerification then@@ -31,26 +32,6 @@ endlocal muc_domain_prefix= module:get_option_string("muc_mapper_domain_prefix", "conference");---- 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---- Verifies room name, domain name with the values in the token-- @param token the token we received-- @param room_address the full room address jiddiff --git a/resources/prosody-plugins/util.lib.lua b/resources/prosody-plugins/util.lib.luanew file mode 100644index 0000000000..b0a6a38f0d--- /dev/null+++ b/resources/prosody-plugins/util.lib.lua@@ -0,0 +1,25 @@+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;+};\ No newline at end of file