|
@@ -16,6 +16,7 @@ local new_id = require 'util.id'.medium;
|
16
|
16
|
local filters = require 'util.filters';
|
17
|
17
|
|
18
|
18
|
local util = module:require 'util';
|
|
19
|
+local ends_with = util.ends_with;
|
19
|
20
|
local is_vpaas = util.is_vpaas;
|
20
|
21
|
local room_jid_match_rewrite = util.room_jid_match_rewrite;
|
21
|
22
|
local get_room_from_jid = util.get_room_from_jid;
|
|
@@ -359,8 +360,19 @@ function process_host_module(name, callback)
|
359
|
360
|
process_host(name);
|
360
|
361
|
end
|
361
|
362
|
end
|
|
363
|
+-- if the message received ends with the main domain, these are system messages
|
|
364
|
+-- for visitors, let's correct the room name there
|
|
365
|
+local function message_handler(event)
|
|
366
|
+ local origin, stanza = event.origin, event.stanza;
|
|
367
|
+
|
|
368
|
+ if ends_with(stanza.attr.from, main_domain) then
|
|
369
|
+ stanza.attr.from = stanza.attr.from:sub(1, -(main_domain:len() + 1))..local_domain;
|
|
370
|
+ end
|
|
371
|
+end
|
|
372
|
+
|
362
|
373
|
process_host_module(local_domain, function(host_module, host)
|
363
|
374
|
host_module:hook('iq/host', stanza_handler, 10);
|
|
375
|
+ host_module:hook('message/full', message_handler);
|
364
|
376
|
end);
|
365
|
377
|
|
366
|
378
|
-- only live chat is supported for visitors
|