# HG changeset patch # User Michel Le Bihan # Date 1543601836 -3600 # Node ID 762c7e7ee64b6af65d700c1e48cf24b9343a2a9f # Parent 4321c71cc53545f10ddd4a734858f3a24b883d04 mod_e2e_policy: Verify that the bare JID of stanza to and from is not in the whitelist diff -r 4321c71cc535 -r 762c7e7ee64b mod_e2e_policy/mod_e2e_policy.lua --- 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");