mod_e2e_policy: Verify that the bare JID of stanza to and from is not in the whitelist
--- a/mod_e2e_policy/mod_e2e_policy.lua Thu Nov 22 23:35:27 2018 +0000
+++ b/mod_e2e_policy/mod_e2e_policy.lua Fri Nov 30 19:17:16 2018 +0100
@@ -1,4 +1,5 @@
local st = require "util.stanza";
+local jid_bare = require "util.jid".bare;
local host = module.host;
local e2e_policy_chat = module:get_option_string("e2e_policy_chat", "optional"); -- possible values: none, optional and required
local e2e_policy_muc = module:get_option_string("e2e_policy_muc", "optional"); -- possible values: none, optional and required
@@ -11,7 +12,7 @@
function warn_on_plaintext_messages(event)
-- check if JID is whitelisted
- if e2e_policy_whitelist:contains(event.stanza.attr.from) or e2e_policy_whitelist:contains(event.stanza.attr.to) then
+ if e2e_policy_whitelist:contains(jid_bare(stanza.attr.from)) or e2e_policy_whitelist:contains(jid_bare(stanza.attr.to)) then
return nil;
end
local body = event.stanza:get_child_text("body");