Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(metadata): Adds lobbyEnabled and visitorsEnabled to metadata. (#16583)

Дамян Минков99cb5e6c4083
diff --git a/resources/prosody-plugins/mod_muc_lobby_rooms.lua b/resources/prosody-plugins/mod_muc_lobby_rooms.lua
index 5a15fd8988..7e7b61e2fc 100644
--- a/resources/prosody-plugins/mod_muc_lobby_rooms.lua
+++ b/resources/prosody-plugins/mod_muc_lobby_rooms.lua
@@ -482,17 +482,34 @@ process_host_module(main_muc_component_config, function(host_module, host)
return;
end
local members_only = event.fields['muc#roomconfig_membersonly'] and true or nil;
+ local room_metadata_changed = false;
if members_only then
local lobby_created = attach_lobby_room(room, actor);
if lobby_created then
module:fire_event('jitsi-lobby-enabled', { room = room; });
event.status_codes['104'] = true;
notify_lobby_enabled(room, actor, true);
+
+ -- let's set it in the metadata and fire the event
+ if not room.jitsiMetadata then
+ room.jitsiMetadata = {};
+ end
+ room.jitsiMetadata.lobbyEnabled = true;
+ room_metadata_changed = true;
end
elseif room._data.lobbyroom then
destroy_lobby_room(room, room.jid);
module:fire_event('jitsi-lobby-disabled', { room = room; });
notify_lobby_enabled(room, actor, false);
+
+ if room.jitsiMetadata then
+ room.jitsiMetadata.lobbyEnabled = false;
+ room_metadata_changed = true;
+ end
+ end
+
+ if room_metadata_changed then
+ host_module:fire_event('room-metadata-changed', { room = room; });
end
end);
host_module:hook('muc-room-destroyed',function(event)
@@ -649,6 +666,13 @@ function handle_create_lobby(event)
room._data.lobby_extra_reason = event.reason;
room._data.lobby_skip_display_name_check = event.skip_display_name_check;
+ -- set in metadata without firing room-metadata-changed,
+ -- as this is a backend call and the caller will take care of that
+ if not room.jitsiMetadata then
+ room.jitsiMetadata = {};
+ end
+ room.jitsiMetadata.lobbyEnabled = true;
+
-- Trigger a presence with 104 so existing participants retrieves new muc#roomconfig
room:broadcast_message(
st.message({ type='groupchat', from=room.jid })
diff --git a/resources/prosody-plugins/mod_visitors_component.lua b/resources/prosody-plugins/mod_visitors_component.lua
index 1e49884c15..92c3e9d19d 100644
--- a/resources/prosody-plugins/mod_visitors_component.lua
+++ b/resources/prosody-plugins/mod_visitors_component.lua
@@ -700,6 +700,13 @@ process_host_module(muc_domain_prefix..'.'..muc_domain_base, function(host_modul
return;
end
+ if always_visitors_enabled then
+ if not room.jitsiMetadata then
+ room.jitsiMetadata = {};
+ end
+ room.jitsiMetadata.visitorsEnabled = true;
+ end
+
go_live(room);
end);
end