mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
feat: Adds option to print not-allowed errors we sent back to client.
This commit is contained in:
@@ -11,12 +11,14 @@ if not muc_domain_base then
|
||||
return
|
||||
end
|
||||
|
||||
local log_not_allowed_errors = module:get_option_boolean('muc_mapper_log_not_allowed_errors', false);
|
||||
|
||||
local util = module:require "util";
|
||||
local room_jid_match_rewrite = util.room_jid_match_rewrite;
|
||||
local internal_room_jid_match_rewrite = util.internal_room_jid_match_rewrite;
|
||||
|
||||
-- We must filter stanzas in order to hook in to all incoming and outgoing messaging which skips the stanza routers
|
||||
function filter_stanza(stanza)
|
||||
function filter_stanza(stanza, session)
|
||||
if stanza.skipMapping then
|
||||
return stanza;
|
||||
end
|
||||
@@ -36,6 +38,16 @@ function filter_stanza(stanza)
|
||||
if stanza.attr.from then
|
||||
stanza.attr.from = internal_room_jid_match_rewrite(stanza.attr.from, stanza)
|
||||
end
|
||||
|
||||
if log_not_allowed_errors and stanza.name == 'presence' and stanza.attr.type == 'error' then
|
||||
local error = stanza:get_child('error');
|
||||
if error and error.attr.type == 'cancel'
|
||||
and error:get_child('not-allowed', 'urn:ietf:params:xml:ns:xmpp-stanzas')
|
||||
and not session.jitsi_not_allowed_logged then
|
||||
session.jitsi_not_allowed_logged = true;
|
||||
session.log('error', 'Not allowed presence %s', stanza);
|
||||
end
|
||||
end
|
||||
end
|
||||
return stanza;
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user