Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(prosody): Moves respond_iq_result to util.

damencho62856b0f5832
diff --git a/resources/prosody-plugins/mod_fmuc.lua b/resources/prosody-plugins/mod_fmuc.lua
index e0325d6325..3c49f0a068 100644
--- a/resources/prosody-plugins/mod_fmuc.lua
+++ b/resources/prosody-plugins/mod_fmuc.lua
@@ -24,6 +24,7 @@ local get_room_from_jid = util.get_room_from_jid;
local get_focus_occupant = util.get_focus_occupant;
local internal_room_jid_match_rewrite = util.internal_room_jid_match_rewrite;
local presence_check_status = util.presence_check_status;
+local respond_iq_result = util.respond_iq_result;
local PARTICIPANT_PROP_RAISE_HAND = 'jitsi_participant_raisedHand';
local PARTICIPANT_PROP_REQUEST_TRANSCRIPTION = 'jitsi_participant_requestingTranscription';
@@ -406,12 +407,7 @@ local function stanza_handler(event)
end
-- respond with successful receiving the iq
- origin.send(st.iq({
- type = 'result';
- from = stanza.attr.to;
- to = stanza.attr.from;
- id = stanza.attr.id
- }));
+ respond_iq_result(origin, stanza);
local req_jid = request_promotion.attr.jid;
-- now let's find the occupant and forward the response
@@ -602,12 +598,7 @@ local function iq_from_main_handler(event)
end
-- respond with successful receiving the iq
- origin.send(st.iq({
- type = 'result';
- from = stanza.attr.to;
- to = stanza.attr.from;
- id = stanza.attr.id
- }));
+ respond_iq_result(origin, stanza);
if process_disconnect then
cancel_destroy_timer(room);
diff --git a/resources/prosody-plugins/mod_visitors_component.lua b/resources/prosody-plugins/mod_visitors_component.lua
index 23ae1c897d..48f356b453 100644
--- a/resources/prosody-plugins/mod_visitors_component.lua
+++ b/resources/prosody-plugins/mod_visitors_component.lua
@@ -15,6 +15,7 @@ local internal_room_jid_match_rewrite = util.internal_room_jid_match_rewrite;
local is_vpaas = util.is_vpaas;
local is_sip_jibri_join = util.is_sip_jibri_join;
local process_host_module = util.process_host_module;
+local respond_iq_result = util.respond_iq_result;
local split_string = util.split_string;
local new_id = require 'util.id'.medium;
local um_is_admin = require 'core.usermanager'.is_admin;
@@ -65,17 +66,6 @@ local visitors_promotion_requests = {};
local cache = require 'util.cache';
local sent_iq_cache = cache.new(200);
--- send iq result that the iq was received and will be processed
-local function respond_iq_result(origin, stanza)
- -- respond with successful receiving the iq
- origin.send(st.iq({
- type = 'result';
- from = stanza.attr.to;
- to = stanza.attr.from;
- id = stanza.attr.id
- }));
-end
-
-- Sends a json-message to the destination jid
-- @param to_jid the destination jid
-- @param json_message the message content to send
diff --git a/resources/prosody-plugins/util.lib.lua b/resources/prosody-plugins/util.lib.lua
index ce0ed1c068..47ae6e1944 100644
--- a/resources/prosody-plugins/util.lib.lua
+++ b/resources/prosody-plugins/util.lib.lua
@@ -1,4 +1,5 @@
local jid = require "util.jid";
+local st = require 'util.stanza';
local timer = require "util.timer";
local http = require "net.http";
local cache = require "util.cache";
@@ -566,6 +567,17 @@ function split_string(str, delimiter)
return result;
end
+-- send iq result that the iq was received and will be processed
+function respond_iq_result(origin, stanza)
+ -- respond with successful receiving the iq
+ origin.send(st.iq({
+ type = 'result';
+ from = stanza.attr.to;
+ to = stanza.attr.from;
+ id = stanza.attr.id
+ }));
+end
+
return {
OUTBOUND_SIP_JIBRI_PREFIXES = OUTBOUND_SIP_JIBRI_PREFIXES;
INBOUND_SIP_JIBRI_PREFIXES = INBOUND_SIP_JIBRI_PREFIXES;
@@ -584,6 +596,7 @@ return {
async_handler_wrapper = async_handler_wrapper;
presence_check_status = presence_check_status;
process_host_module = process_host_module;
+ respond_iq_result = respond_iq_result;
room_jid_match_rewrite = room_jid_match_rewrite;
room_jid_split_subdomain = room_jid_split_subdomain;
internal_room_jid_match_rewrite = internal_room_jid_match_rewrite;