Skip to content
View Ttom77's full-sized avatar

Block or report Ttom77

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
Ttom77/README.md

function tablelength(T) local hash = {} local res = {}

    for _,v in ipairs(T) do
       if (not hash[v]) then
           res[#res+1] = v
           hash[v] = true
       end
    end

    local count = 0
    for _ in pairs(res) do count = count + 1 end
    return count

end

function getNbConfPart() local tab={};

--conferences count (without eliminating duplicates )
for key, value in pairs(prosody.full_sessions) do
        if tostring(value["username"]:lower()) ~= "focus" then
                table.insert(tab,tostring(value["jitsi_meet_room"]:lower()));
        end
end

local nbPart = 0
if it.count(it.keys(prosody.full_sessions))-1 >= 0 --participants count
        then nbPart= it.count(it.keys(prosody.full_sessions))-1
end

local nbConf = tablelength(tab) --conferences count
if nbPart == 0
        then nbConf=0
end

 --create result as json
local result_json=array();
result_json:push({
                part= nbPart,
                conf=tablelength(tab) -- eliminates count number of rooms
        });

-- create json response 
return json.encode(result_json);

end

function module.load() module:depends("http"); module:provides("http", { default_path = "/"; route = { ["GET room-size"] = function (event) return wrap_async_run(event,handle_get_room_size) end; ["GET sessions"] = function () return tostring(it.count(it.keys(prosody.full_sessions))); end; ["GET room"] = function (event) return wrap_async_run(event,handle_get_room) end; ["GET nbConfPart"] = function (event) return wrap_async_run(event,getNbConfPart) end; }; }); end

Popular repositories Loading

  1. Ttom77 Ttom77 Public

    Config files for my GitHub profile.