ref: Make is_healthcheck_room more generic.

This commit is contained in:
Boris Grozev 2020-05-12 16:40:39 -05:00 committed by bgrozev
parent 591ea0a44a
commit 76e1217439
5 changed files with 11 additions and 10 deletions

View File

@ -3,7 +3,7 @@ local is_healthcheck_room = module:require "util".is_healthcheck_room;
module:hook("muc-occupant-joined", function (event)
local room, occupant = event.room, event.occupant;
if is_healthcheck_room(room) then
if is_healthcheck_room(room.jid) then
return;
end
@ -13,7 +13,7 @@ end, 2);
module:hook("muc-occupant-left", function (event)
local room, occupant = event.room, event.occupant;
if is_healthcheck_room(room) then
if is_healthcheck_room(room.jid) then
return;
end

View File

@ -209,7 +209,7 @@ process_host_module(main_muc_component_config, function(host_module, host)
host_module:hook('muc-occupant-pre-join', function (event)
local room, stanza = event.room, event.stanza;
if is_healthcheck_room(room) then
if is_healthcheck_room(room.jid) then
return;
end

View File

@ -9,7 +9,7 @@ local is_healthcheck_room = module:require "util".is_healthcheck_room;
module:hook("muc-room-created", function(event)
local room = event.room;
if is_healthcheck_room(room) then
if is_healthcheck_room(room.jid) then
return;
end

View File

@ -113,7 +113,7 @@ end
function room_created(event)
local room = event.room;
if is_healthcheck_room(room) then
if is_healthcheck_room(room.jid) then
return;
end
@ -124,7 +124,7 @@ end
function occupant_joined(event)
local room = event.room;
if is_healthcheck_room(room) then
if is_healthcheck_room(room.jid) then
return;
end
@ -184,7 +184,7 @@ end
function occupant_leaving(event)
local room = event.room;
if is_healthcheck_room(room) then
if is_healthcheck_room(room.jid) then
return;
end
@ -205,7 +205,7 @@ end
function room_destroyed(event)
local room = event.room;
if is_healthcheck_room(room) then
if is_healthcheck_room(room.jid) then
return;
end

View File

@ -175,9 +175,10 @@ end
function starts_with(str, start)
return str:sub(1, #start) == start
end
-- healthcheck rooms in jicofo starts with a string '__jicofo-health-check'
function is_healthcheck_room(room)
if starts_with(room.jid, "__jicofo-health-check") then
function is_healthcheck_room(room_jid)
if starts_with(room_jid, "__jicofo-health-check") then
return true;
end