Skip to content

Commit f1a0012

Browse files
committed
fix: Fixes sending metadata to jicofo.
In cases like waiting-for-host lobby, jicofo can leave the room and rejoin later, without the room being destroyed. We need to make sure the metadata will reach jicofo on second attempt.
1 parent 85522ae commit f1a0012

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

resources/prosody-plugins/mod_room_metadata_component.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,17 @@ function process_main_muc_loaded(main_muc, host_module)
261261
host_module:fire_event('room-metadata-changed', { room = room; });
262262
end
263263
end);
264+
265+
-- The the connection jid for authenticated users (like jicofo) stays the same,
266+
-- so leaving and re-joining will result not sending metatadata again.
267+
-- Make sure we clear the sent_initial_metadata entry for the occupant on leave.
268+
host_module:hook("muc-occupant-left", function(event)
269+
local room, occupant = event.room, event.occupant;
270+
271+
if room.sent_initial_metadata then
272+
room.sent_initial_metadata[jid.bare(event.occupant.jid)] = nil;
273+
end
274+
end);
264275
end
265276

266277
-- process or waits to process the main muc component

0 commit comments

Comments
 (0)