You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mod_muc_meeting_id.lua 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. local uuid_gen = require "util.uuid".generate;
  2. local is_healthcheck_room = module:require "util".is_healthcheck_room;
  3. -- Module that generates a unique meetingId, attaches it to the room
  4. -- and adds it to all disco info form data (when room is queried or in the
  5. -- initial room owner config)
  6. -- Hook to assign meetingId for new rooms
  7. module:hook("muc-room-created", function(event)
  8. local room = event.room;
  9. if is_healthcheck_room(room) then
  10. return;
  11. end
  12. room._data.meetingId = uuid_gen();
  13. module:log("debug", "Created meetingId:%s for %s",
  14. room._data.meetingId, room.jid);
  15. end);
  16. -- Returns the meeting config Id form data.
  17. function getMeetingIdConfig(room)
  18. return {
  19. name = "muc#roominfo_meetingId";
  20. type = "text-single";
  21. label = "The meeting unique id.";
  22. value = room._data.meetingId or "";
  23. };
  24. end
  25. -- add meeting Id to the disco info requests to the room
  26. module:hook("muc-disco#info", function(event)
  27. table.insert(event.form, getMeetingIdConfig(event.room));
  28. end);
  29. -- add the meeting Id in the default config we return to jicofo
  30. module:hook("muc-config-form", function(event)
  31. table.insert(event.form, getMeetingIdConfig(event.room));
  32. end, 90-3);