|
@@ -0,0 +1,31 @@
|
|
1
|
+--This module performs features checking when a transcription is requested.
|
|
2
|
+--If the transcription feature is not allowed, the tag indicating that a
|
|
3
|
+--transcription is being requested will be stripped from the presence stanza.
|
|
4
|
+--The module must be enabled under the muc component.
|
|
5
|
+local is_feature_allowed = module:require "util".is_feature_allowed;
|
|
6
|
+
|
|
7
|
+module:log("info", "Loading mod_muc_transcription_filter!");
|
|
8
|
+local filtered_tag_name = "jitsi_participant_requestingTranscription";
|
|
9
|
+
|
|
10
|
+function filter_transcription_tag(event)
|
|
11
|
+ local stanza = event.stanza;
|
|
12
|
+ local session = event.origin;
|
|
13
|
+ if stanza and stanza.name == "presence" then
|
|
14
|
+ if not is_feature_allowed(session,'transcription') then
|
|
15
|
+ stanza:maptags(function(tag)
|
|
16
|
+ if tag and tag.name == filtered_tag_name then
|
|
17
|
+ module:log("info", "Removing %s tag from presence stanza!", filtered_tag_name);
|
|
18
|
+ return nil;
|
|
19
|
+ else
|
|
20
|
+ return tag;
|
|
21
|
+ end
|
|
22
|
+ end)
|
|
23
|
+ end
|
|
24
|
+ end
|
|
25
|
+end
|
|
26
|
+
|
|
27
|
+module:hook("presence/bare", filter_transcription_tag);
|
|
28
|
+module:hook("presence/full", filter_transcription_tag);
|
|
29
|
+module:hook("presence/host", filter_transcription_tag);
|
|
30
|
+
|
|
31
|
+module:log("info", "Loaded mod_muc_transcription_filter!");
|