<commit_before>-- This module is added under the main virtual host domain
--
-- VirtualHost "jitmeet.example.com"
--     modules_enabled = {
--         "end_conference"
--     }
--     end_conference_component = "endconference.jitmeet.example.com"
--
-- Component "endconference.jitmeet.example.com" "end_conference"
--     muc_component = muc.jitmeet.example.com
--
local get_room_by_name_and_subdomain = module:require 'util'.get_room_by_name_and_subdomain;

local END_CONFERENCE_REASON = 'The meeting has been terminated';

local end_conference_component = module:get_option_string('end_conference_component', 'endconference.'..module.host);
if end_conference_component == nil then
    module:log('error', 'No end_conference_component specified.');
    return;
end

-- Advertise end conference so client can pick up the address and use it
module:add_identity('component', 'end_conference', end_conference_component);

module:depends("jitsi_session");

local muc_component_host = module:get_option_string('muc_component');
if muc_component_host == nil then
    module:log('error', 'No muc_component specified. No muc to operate on!');
    return;
end

module:log('info', 'Starting end_conference for %s', muc_component_host);

-- receives messages from clients to the component to end a conference
function on_message(event)<commit_msg>refactor(end-conference): distinguish between component vs host module logic<commit_after>-- This module is added under the main virtual host domain
--
-- VirtualHost "jitmeet.example.com"
--     modules_enabled = {
--         "end_conference"
--     }
--     end_conference_component = "endconference.jitmeet.example.com"
--
-- Component "endconference.jitmeet.example.com" "end_conference"
--     muc_component = muc.jitmeet.example.com
--
local get_room_by_name_and_subdomain = module:require 'util'.get_room_by_name_and_subdomain;

local END_CONFERENCE_REASON = 'The meeting has been terminated';

-- Since this file serves as both the host module and the component, we rely on the assumption that
-- end_conference_component var would only be define for the host and not in the end_conference component
local end_conference_component = module:get_option_string('end_conference_component');
if end_conference_component then
    -- Advertise end conference so client can pick up the address and use it
    module:add_identity('component', 'end_conference', end_conference_component);
    return;  -- nothing left to do if called as host module
end

-- What follows is logic for the end_conference component

module:depends("jitsi_session");

local muc_component_host = module:get_option_string('muc_component');
if muc_component_host == nil then
    module:log('error', 'No muc_component specified. No muc to operate on!');
    return;
end

module:log('info', 'Starting end_conference for %s', muc_component_host);

-- receives messages from clients to the component to end a conference
function on_message(event)
{'fraction_non_alphanumeric': 0.0941096817874069, 'fraction_numerical': 0.0, 'mean_word_length': 5.0060975609756095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7242296', 'n_tokens_mistral': 889, 'n_tokens_neox': 860, 'n_words': 252}