Skip to content

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

Fixes the room size api which returns string result back to client.

damenchod12afc5c0711
diff --git a/resources/prosody-plugins/mod_muc_size.lua b/resources/prosody-plugins/mod_muc_size.lua
index 3f51f5b1ae..fe1b345801 100644
--- a/resources/prosody-plugins/mod_muc_size.lua
+++ b/resources/prosody-plugins/mod_muc_size.lua
@@ -105,19 +105,14 @@ function handle_get_room_size(event)
"there are %s occupants in room", tostring(participant_count));
else
log("debug", "no such room exists");
+ return 404;
end
if participant_count > 1 then
participant_count = participant_count - 1;
end
- local GET_response = {
- headers = {
- content_type = "application/json";
- };
- body = [[{"participants":]]..participant_count..[[}]];
- };
- return GET_response;
+ return [[{"participants":]]..participant_count..[[}]];
end
--- Handles request for retrieving the room participants details
@@ -171,19 +166,14 @@ function handle_get_room (event)
"there are %s occupants in room", tostring(participant_count));
else
log("debug", "no such room exists");
+ return 404;
end
if participant_count > 1 then
participant_count = participant_count - 1;
end
- local GET_response = {
- headers = {
- content_type = "application/json";
- };
- body = json.encode(occupants_json);
- };
- return GET_response;
+ return json.encode(occupants_json);
end;
function module.load()
diff --git a/resources/prosody-plugins/util.lib.lua b/resources/prosody-plugins/util.lib.lua
index 9556364379..4ccfe3d687 100644
--- a/resources/prosody-plugins/util.lib.lua
+++ b/resources/prosody-plugins/util.lib.lua
@@ -66,9 +66,16 @@ function wrap_async_run(event,handler)
-- the handler is done.
local response = event.response;
local async_func = runner(function (event)
- response.status_code = handler(event);
- -- Send the response to the waiting http client.
- response:send();
+ local result = handler(event);
+ -- if it is a number, it is a status code, else it is the body
+ -- result we will return
+ if (tonumber(result) ~= nil) then
+ response.status_code = result;
+ else
+ response.body = result;
+ end;
+ -- Send the response to the waiting http client.
+ response:send();
end)
async_func:run(event)
-- return true to keep the client http connection open.