Skip to content

Commit

Permalink
feat: add Message Handling for jitsi/lib-jitsi-meet/pull/2339
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloodiko committed Aug 24, 2023
1 parent 25fdea9 commit 858071e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions resources/prosody-plugins/mod_muc_breakout_rooms.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ local JSON_TYPE_MOVE_TO_ROOM_REQUEST = 'features/breakout-rooms/move-to-room';
local JSON_TYPE_REMOVE_BREAKOUT_ROOM = 'features/breakout-rooms/remove';
local JSON_TYPE_RENAME_BREAKOUT_ROOM = 'features/breakout-rooms/rename';
local JSON_TYPE_UPDATE_BREAKOUT_ROOMS = 'features/breakout-rooms/update';
local JSON_TYPE_MESSAGE_TO_ROOM = 'features/breakout-rooms/message-to-room';

local main_muc_component_config = module:get_option_string('main_muc');
if main_muc_component_config == nil then
Expand Down Expand Up @@ -257,6 +258,19 @@ function rename_breakout_room(room_jid, name)
end
end

function message_breakout_room(room_jid, textContent, nick)
local breakout_room = breakout_rooms_muc_service.get_room_from_jid(room_jid);

if breakout_room then
breakout_room:broadcast_message(
st.message({
from = breakout_room.name .. '/' .. nick,
type = 'groupchat
}):tag('body'):text(textContent)
);
end
end

-- Handling events

function on_message(event)
Expand Down Expand Up @@ -333,6 +347,9 @@ function on_message(event)

send_json_msg(participant_jid, json_msg)
return true;
elseif message.attr.type == JSON_TYPE_MESSAGE_TO_ROOM then
message_breakout_room(message.attr.roomJid, message.attr.textContent, occupant.nick);
return true;
end

-- return error.
Expand Down

0 comments on commit 858071e

Please sign in to comment.