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) module:hook("muc-occupant-joined", function (event)
local room, occupant = event.room, event.occupant; local room, occupant = event.room, event.occupant;
if is_healthcheck_room(room) then if is_healthcheck_room(room.jid) then
return; return;
end end
@ -13,7 +13,7 @@ end, 2);
module:hook("muc-occupant-left", function (event) module:hook("muc-occupant-left", function (event)
local room, occupant = event.room, event.occupant; local room, occupant = event.room, event.occupant;
if is_healthcheck_room(room) then if is_healthcheck_room(room.jid) then
return; return;
end 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) host_module:hook('muc-occupant-pre-join', function (event)
local room, stanza = event.room, event.stanza; local room, stanza = event.room, event.stanza;
if is_healthcheck_room(room) then if is_healthcheck_room(room.jid) then
return; return;
end end

View File

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

View File

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

View File

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