|
@@ -0,0 +1,34 @@
|
|
1
|
+local uuid_gen = require "util.uuid".generate;
|
|
2
|
+
|
|
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
|
+
|
|
7
|
+-- Hook to assign meetingId for new rooms
|
|
8
|
+module:hook("muc-room-created", function(event)
|
|
9
|
+ local room = event.room;
|
|
10
|
+ room._data.meetingId = uuid_gen();
|
|
11
|
+
|
|
12
|
+ module:log("debug", "Created meetingId:%s for %s",
|
|
13
|
+ room._data.meetingId, room.jid);
|
|
14
|
+end);
|
|
15
|
+
|
|
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
|
+
|
|
26
|
+-- add meeting Id to the disco info requests to the room
|
|
27
|
+module:hook("muc-disco#info", function(event)
|
|
28
|
+ table.insert(event.form, getMeetingIdConfig(event.room));
|
|
29
|
+end);
|
|
30
|
+
|
|
31
|
+-- add the meeting Id in the default config we return to jicofo
|
|
32
|
+module:hook("muc-config-form", function(event)
|
|
33
|
+ table.insert(event.form, getMeetingIdConfig(event.room));
|
|
34
|
+end, 90-3);
|