in resources/prosody-plugins/mod_filter_iq_rayo.lua [121:178]
function get_concurrent_outgoing_count(context_user, context_group)
local count = 0;
for _, host in pairs(hosts) do
local component = host;
if component then
local muc = component.modules.muc
local rooms = nil;
if muc and rawget(muc,"rooms") then
return muc.rooms;
elseif muc and rawget(muc,"live_rooms") then
rooms = muc.live_rooms();
elseif muc and rawget(muc,"each_room") then
rooms = muc.each_room(true);
end
if rooms then
for room in rooms do
for _, occupant in room:each_occupant() do
for _, presence in occupant:each_session() do
local initiator = presence:get_child('initiator', 'http://jitsi.org/protocol/jigasi');
local found_user = false;
local found_group = false;
if initiator then
initiator:maptags(function (tag)
if tag.name == "header"
and tag.attr.name == OUT_INITIATOR_USER_ATTR_NAME then
found_user = tag.attr.value == context_user;
elseif tag.name == "header"
and tag.attr.name == OUT_INITIATOR_GROUP_ATTR_NAME then
found_group = tag.attr.value == context_group;
end
return tag;
end );
if found_user
and (context_group == nil or found_group) then
count = count + 1;
end
end
end
end
end
end
end
end
return count;
end