Mercurial > prosody-modules
changeset 3385:762c7e7ee64b
mod_e2e_policy: Verify that the bare JID of stanza to and from is not in the whitelist
author | Michel Le Bihan <michel@lebihan.pl> |
---|---|
date | Fri, 30 Nov 2018 19:17:16 +0100 |
parents | 4321c71cc535 |
children | a76c420eca61 |
files | mod_e2e_policy/mod_e2e_policy.lua |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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");