Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(system_chat_message): Fixes delivering system messages to visitors.

damencho205f88ec5a50
diff --git a/resources/prosody-plugins/mod_fmuc.lua b/resources/prosody-plugins/mod_fmuc.lua
index 6fe23ce576..d4a9406dca 100644
--- a/resources/prosody-plugins/mod_fmuc.lua
+++ b/resources/prosody-plugins/mod_fmuc.lua
@@ -16,6 +16,7 @@ local new_id = require 'util.id'.medium;
local filters = require 'util.filters';
local util = module:require 'util';
+local ends_with = util.ends_with;
local is_vpaas = util.is_vpaas;
local room_jid_match_rewrite = util.room_jid_match_rewrite;
local get_room_from_jid = util.get_room_from_jid;
@@ -359,8 +360,19 @@ function process_host_module(name, callback)
process_host(name);
end
end
+-- if the message received ends with the main domain, these are system messages
+-- for visitors, let's correct the room name there
+local function message_handler(event)
+ local origin, stanza = event.origin, event.stanza;
+
+ if ends_with(stanza.attr.from, main_domain) then
+ stanza.attr.from = stanza.attr.from:sub(1, -(main_domain:len() + 1))..local_domain;
+ end
+end
+
process_host_module(local_domain, function(host_module, host)
host_module:hook('iq/host', stanza_handler, 10);
+ host_module:hook('message/full', message_handler);
end);
-- only live chat is supported for visitors