Comparison

mod_e2e_policy/mod_e2e_policy.lua @ 3386:a76c420eca61

mod_e2e_policy: Fix an error with getting stanza from event
author Michel Le Bihan <michel@lebihan.pl>
date Fri, 30 Nov 2018 19:31:25 +0100
parent 3385:762c7e7ee64b
comparison
equal deleted inserted replaced
3385:762c7e7ee64b 3386:a76c420eca61
10 local e2e_policy_message_optional_muc = module:get_option_string("e2e_policy_message_optional_muc", "For security reasons, OMEMO, OTR or PGP encryption is STRONGLY recommended for MUC on this server."); 10 local e2e_policy_message_optional_muc = module:get_option_string("e2e_policy_message_optional_muc", "For security reasons, OMEMO, OTR or PGP encryption is STRONGLY recommended for MUC on this server.");
11 local e2e_policy_message_required_muc = module:get_option_string("e2e_policy_message_required_muc", "For security reasons, OMEMO, OTR or PGP encryption is required for MUC on this server."); 11 local e2e_policy_message_required_muc = module:get_option_string("e2e_policy_message_required_muc", "For security reasons, OMEMO, OTR or PGP encryption is required for MUC on this server.");
12 12
13 function warn_on_plaintext_messages(event) 13 function warn_on_plaintext_messages(event)
14 -- check if JID is whitelisted 14 -- check if JID is whitelisted
15 if e2e_policy_whitelist:contains(jid_bare(stanza.attr.from)) or e2e_policy_whitelist:contains(jid_bare(stanza.attr.to)) then 15 if e2e_policy_whitelist:contains(jid_bare(event.stanza.attr.from)) or e2e_policy_whitelist:contains(jid_bare(event.stanza.attr.to)) then
16 return nil; 16 return nil;
17 end 17 end
18 local body = event.stanza:get_child_text("body"); 18 local body = event.stanza:get_child_text("body");
19 -- do not warn for status messages 19 -- do not warn for status messages
20 if not body or event.stanza.attr.type == "error" then 20 if not body or event.stanza.attr.type == "error" then