diff options
| author | Melvin Keskin <melvo@olomono.de> | 2022-05-09 21:45:49 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2022-08-13 15:55:03 +0200 |
| commit | ceb62dd9d0d86bc8327ace116930962cf7fad1e9 (patch) | |
| tree | 35bdcccf3e1bebddadcdab6205383975ca66e4c4 /src/base/QXmppMessage.cpp | |
| parent | ec0669845b9072ea6cdc0fefb66f1d07511386a4 (diff) | |
| download | qxmpp-ceb62dd9d0d86bc8327ace116930962cf7fad1e9.tar.gz | |
Implement XEP-0384: OMEMO Encryption v0.8
This implements XEP-0384 in version v0.8 with a manager and storage
classes to be user-implemented for persistant storage.
The license of the code is LGPL-2.1-or-later as usual. However since
libomemo-c (libsignal-protocol-c) is GPL-3.0, the built binary is always
licensed under GPL-3.0. Having our code LGPL licensed will make it
avoids relicensing in the future in case we port it to an LGPL
compatible omemo library.
Closes #133.
Co-authored-by: Linus Jahn <lnj@kaidan.im>
Diffstat (limited to 'src/base/QXmppMessage.cpp')
| -rw-r--r-- | src/base/QXmppMessage.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/base/QXmppMessage.cpp b/src/base/QXmppMessage.cpp index d583fd7e..2f0fb5fe 100644 --- a/src/base/QXmppMessage.cpp +++ b/src/base/QXmppMessage.cpp @@ -11,8 +11,10 @@ #include "QXmppConstants_p.h" #include "QXmppGlobal_p.h" #include "QXmppMixInvitation.h" +#ifdef BUILD_OMEMO #include "QXmppOmemoElement_p.h" #include "QXmppOmemoEnvelope_p.h" +#endif #include "QXmppTrustMessageElement.h" #include "QXmppUtils.h" @@ -136,10 +138,10 @@ public: // XEP-0382: Spoiler messages bool isSpoiler; QString spoilerHint; - +#ifdef BUILD_OMEMO // XEP-0384: OMEMO Encryption std::optional<QXmppOmemoElement> omemoElement; - +#endif // XEP-0407: Mediated Information eXchange (MIX): Miscellaneous Capabilities std::optional<QXmppMixInvitation> mixInvitation; @@ -1078,6 +1080,8 @@ void QXmppMessage::setSpoilerHint(const QString &spoilerHint) d->isSpoiler = true; } +#ifdef BUILD_OMEMO +/// \cond /// /// Returns an included OMEMO element as defined by \xep{0384, OMEMO Encryption}. /// @@ -1097,6 +1101,8 @@ void QXmppMessage::setOmemoElement(const std::optional<QXmppOmemoElement> &omemo { d->omemoElement = omemoElement; } +/// \endcond +#endif /// /// Returns an included \xep{0369}: Mediated Information eXchange (MIX) @@ -1297,6 +1303,7 @@ bool QXmppMessage::parseExtension(const QDomElement &element, QXmpp::SceMode sce d->encryptionName = element.attribute(QStringLiteral("name")); return true; } +#ifdef BUILD_OMEMO // XEP-0384: OMEMO Encryption if (QXmppOmemoElement::isOmemoElement(element)) { QXmppOmemoElement omemoElement; @@ -1304,6 +1311,7 @@ bool QXmppMessage::parseExtension(const QDomElement &element, QXmpp::SceMode sce d->omemoElement = omemoElement; return true; } +#endif // XEP-0428: Fallback Indication if (checkElement(element, QStringLiteral("fallback"), ns_fallback_indication)) { d->isFallback = true; @@ -1523,10 +1531,12 @@ void QXmppMessage::serializeExtensions(QXmlStreamWriter *writer, QXmpp::SceMode writer->writeEndElement(); } +#ifdef BUILD_OMEMO // XEP-0384: OMEMO Encryption if (d->omemoElement) { d->omemoElement->toXml(writer); } +#endif // XEP-0428: Fallback Indication if (d->isFallback) { |
