Add support for OMEMO and PGP encryption

This commit is contained in:
Travis Burtrum 2016-06-12 20:46:55 -04:00
parent d5e3b61758
commit aca3b89983
1 changed files with 15 additions and 3 deletions

View File

@ -26,11 +26,11 @@ local st = require "util.stanza";
local policy = module:get_option_string("otr_policy", "optional");
local mandatory;
local mandatory_msg = "For security reasons, OTR encryption is required for conversations on this server";
local mandatory_msg = "For security reasons, OTR, OMEMO, or PGP encryption is required for conversations on this server";
local optional;
local optional_msg = "For security reasons, OTR encryption is STRONGLY recommended for conversations on this server";
local optional_msg = "For security reasons, OTR, OMEMO, or PGP encryption is STRONGLY recommended for conversations on this server";
local mixed;
local muc_msg = "Beware, Multi-User Chat is not supported by OTR."
local muc_msg = "Beware, Multi-User Chat is not supported by OTR, but is supported by OMEMO or PGP in specific circumstances with some clients."
local messaged = {};
@ -70,6 +70,18 @@ local function check_message_otr(event)
return nil;
end
-- check omemo https://xmpp.org/extensions/inbox/omemo.html
if event.stanza:get_child("encrypted", "eu.siacs.conversations.axolotl") or event.stanza:get_child("encrypted", "urn:xmpp:omemo:0") then
return nil;
end
-- check xep27 pgp https://xmpp.org/extensions/xep-0027.html
if event.stanza:get_child("x", "jabber:x:encrypted") then
return nil;
end
-- no valid encryption found
-- Warn the user that OTR will not work on MUC but let the message pass.
-- Available for optional and mixed mode.
if stanza.attr.type == "groupchat" and not mandatory then