From bb8780ecdbfe7eddb8280e696871e71b744d0bff Mon Sep 17 00:00:00 2001 From: Melvin Keskin Date: Sat, 28 Aug 2021 14:39:02 +0200 Subject: Add QXmppAtmManager --- src/base/QXmppConstants.cpp | 2 ++ src/base/QXmppConstants_p.h | 2 ++ src/base/QXmppMessage.cpp | 39 +++++++++++++++++++++++++++++++++++++++ src/base/QXmppMessage.h | 3 +++ 4 files changed, 46 insertions(+) (limited to 'src/base') diff --git a/src/base/QXmppConstants.cpp b/src/base/QXmppConstants.cpp index db896683..c6ae77de 100644 --- a/src/base/QXmppConstants.cpp +++ b/src/base/QXmppConstants.cpp @@ -186,3 +186,5 @@ const char* ns_mix_misc = "urn:xmpp:mix:misc:0"; const char* ns_fallback_indication = "urn:xmpp:fallback:0"; // XEP-0434: Trust Messages (TM) const char* ns_tm = "urn:xmpp:tm:0"; +// XEP-0450: Automatic Trust Management (ATM) +const char* ns_atm = "urn:xmpp:atm:1"; diff --git a/src/base/QXmppConstants_p.h b/src/base/QXmppConstants_p.h index 1d55ad03..2b9e70d6 100644 --- a/src/base/QXmppConstants_p.h +++ b/src/base/QXmppConstants_p.h @@ -198,5 +198,7 @@ extern const char* ns_mix_misc; extern const char* ns_fallback_indication; // XEP-0434: Trust Messages (TM) extern const char* ns_tm; +// XEP-0450: Automatic Trust Management (ATM) +extern const char* ns_atm; #endif // QXMPPCONSTANTS_H diff --git a/src/base/QXmppMessage.cpp b/src/base/QXmppMessage.cpp index f975ae3c..e97731ae 100644 --- a/src/base/QXmppMessage.cpp +++ b/src/base/QXmppMessage.cpp @@ -108,6 +108,7 @@ public: QString thread; QString parentThread; QXmppMessage::Type type; + QString senderKey; // XEP-0066: Out of Band Data QString outOfBandUrl; @@ -324,6 +325,44 @@ void QXmppMessage::setParentThread(const QString &parent) d->parentThread = parent; } +/// +/// Returns the ID of this message's sender's public long-term key. +/// +/// The key ID is not part of a transmitted message and thus not de- / +/// serialized. +/// Instead, the key ID is set by an encryption protocol such as +/// \xep{0384, OMEMO Encryption} when it decrypts this message. +/// It can be used by trust management protocols such as +/// \xep{0450, Automatic Trust Management (ATM)}. +/// +/// \return the ID of the sender's key +/// +/// \since QXmpp 1.5 +/// +QString QXmppMessage::senderKey() const +{ + return d->senderKey; +} + +/// +/// Sets the ID of this message's sender's public long-term key. +/// +/// The key ID is not part of a transmitted message and thus not de- / +/// serialized. +/// Instead, the key ID is set by an encryption protocol such as +/// \xep{0384, OMEMO Encryption} when it decrypts this message. +/// It can be used by trust management protocols such as +/// \xep{0450, Automatic Trust Management (ATM)}. +/// +/// \param keyId ID of the sender's key +/// +/// \since QXmpp 1.5 +/// +void QXmppMessage::setSenderKey(const QString &keyId) +{ + d->senderKey = keyId; +} + /// /// Returns a possibly attached URL from \xep{0066}: Out of Band Data /// diff --git a/src/base/QXmppMessage.h b/src/base/QXmppMessage.h index 6688d3b6..b2cb972d 100644 --- a/src/base/QXmppMessage.h +++ b/src/base/QXmppMessage.h @@ -136,6 +136,9 @@ public: QXmppMessage::Type type() const; void setType(QXmppMessage::Type); + QString senderKey() const; + void setSenderKey(const QString &keyId); + // XEP-0066: Out of Band Data QString outOfBandUrl() const; void setOutOfBandUrl(const QString &); -- cgit v1.2.3