Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

mod_muc_meeting_id.lua 1.1KB

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