"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-5079/resources/prosody-plugins/mod_muc_meeting_id.lua" (17 Jun 2021, 1241 Bytes) of package /linux/misc/jitsi-meet-5079.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

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