changeset 2331:611a787e6d08

mod_e2e_policy: Do not reply to error stenzas
author Michel Le Bihan <michel@lebihan.pl>
date Thu, 13 Oct 2016 16:53:40 +0200
parents f933e3909795
children c2cf5b40b66d
files mod_e2e_policy/mod_e2e_policy.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_e2e_policy/mod_e2e_policy.lua	Thu Oct 13 12:26:45 2016 +0200
+++ b/mod_e2e_policy/mod_e2e_policy.lua	Thu Oct 13 16:53:40 2016 +0200
@@ -10,12 +10,13 @@
 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.");
 
 function warn_on_plaintext_messages(event)
-    if e2e_policy_whitelist:contains(event.stanza.attr.from) or e2e_policy_whitelist:contains(event.stanza.attr.to) then -- check if JID is whitelisted
+    -- check if JID is whitelisted
+    if e2e_policy_whitelist:contains(event.stanza.attr.from) or e2e_policy_whitelist:contains(event.stanza.attr.to) then
         return nil;
     end
     local body = event.stanza:get_child_text("body");
     -- do not warn for status messages
-    if not body then
+    if not body or event.stanza.attr.type == "error" then
         return nil;
     end
     -- check otr
@@ -30,7 +31,7 @@
     if event.stanza:get_child("x", "jabber:x:encrypted") then
         return nil;
     end
-	-- check xep373 pgp (OX) https://xmpp.org/extensions/xep-0373.html
+    -- check xep373 pgp (OX) https://xmpp.org/extensions/xep-0373.html
     if event.stanza:get_child("openpgp", "urn:xmpp:openpgp:0") then
         return nil;
     end