From a3e110d6a219f2dc3bfd6d8fc238f5d022f30aea Mon Sep 17 00:00:00 2001 From: Melvin Keskin Date: Sat, 26 Mar 2022 12:26:07 +0100 Subject: Message: Replace QXmppMessage::EncryptionMethod with QXmpp::Encryption --- src/base/QXmppMessage.cpp | 10 +++++----- src/base/QXmppMessage.h | 35 +++++++++++++++-------------------- 2 files changed, 20 insertions(+), 25 deletions(-) (limited to 'src/base') diff --git a/src/base/QXmppMessage.cpp b/src/base/QXmppMessage.cpp index e493cf17..dfb60240 100644 --- a/src/base/QXmppMessage.cpp +++ b/src/base/QXmppMessage.cpp @@ -972,15 +972,15 @@ void QXmppMessage::setMixUserNick(const QString &mixUserNick) /// /// \since QXmpp 1.1 /// -QXmppMessage::EncryptionMethod QXmppMessage::encryptionMethod() const +QXmpp::Encryption QXmppMessage::encryptionMethod() const { if (d->encryptionMethod.isEmpty()) - return QXmppMessage::NoEncryption; + return QXmpp::NoEncryption; int index = ENCRYPTION_NAMESPACES.indexOf(d->encryptionMethod); if (index < 0) - return QXmppMessage::UnknownEncryption; - return static_cast(index); + return QXmpp::UnknownEncryption; + return static_cast(index); } /// @@ -989,7 +989,7 @@ QXmppMessage::EncryptionMethod QXmppMessage::encryptionMethod() const /// /// \since QXmpp 1.1 /// -void QXmppMessage::setEncryptionMethod(QXmppMessage::EncryptionMethod method) +void QXmppMessage::setEncryptionMethod(QXmpp::Encryption method) { d->encryptionMethod = ENCRYPTION_NAMESPACES.at(int(method)); } diff --git a/src/base/QXmppMessage.h b/src/base/QXmppMessage.h index b7db3eab..1f0c81b5 100644 --- a/src/base/QXmppMessage.h +++ b/src/base/QXmppMessage.h @@ -29,6 +29,19 @@ class QXmppTrustMessageElement; class QXMPP_EXPORT QXmppMessage : public QXmppStanza { public: +/// \cond +#if QXMPP_DEPRECATED_SINCE(1, 5) + using EncryptionMethod = QXmpp::Encryption; + + static const EncryptionMethod NoEncryption = EncryptionMethod::NoEncryption; + static const EncryptionMethod UnknownEncryption = EncryptionMethod::UnknownEncryption; + static const EncryptionMethod OTR = EncryptionMethod::Otr; + static const EncryptionMethod LegacyOpenPGP = EncryptionMethod::LegacyOpenPgp; + static const EncryptionMethod OX = EncryptionMethod::Ox; + static const EncryptionMethod OMEMO = EncryptionMethod::Omemo; +#endif +/// \endcond + /// This enum describes a message type. enum Type { Error = 0, @@ -77,24 +90,6 @@ public: Store = 1 << 3 ///< Do store the message }; - /// - /// This enum describes different end-to-end encryption methods. These can - /// be used to mark a message explicitly as encrypted with a specific - /// algorithm. See \xep{0380, Explicit Message Encryption} for details. - /// - /// \since QXmpp 1.1 - /// - enum EncryptionMethod { - NoEncryption, ///< No encryption - UnknownEncryption, ///< Unknown encryption - OTR, ///< \xep{0364, Current Off-the-Record Messaging Usage} - LegacyOpenPGP, ///< \xep{0027, Current Jabber OpenPGP Usage} - OX, ///< \xep{0373, OpenPGP for XMPP} - OMEMO, ///< \xep{0384, OMEMO Encryption} - OMEMO1, ///< \xep{0384, OMEMO Encryption} since version 0.4 - OMEMO2 ///< \xep{0384, OMEMO Encryption} since version 0.8 - }; - QXmppMessage(const QString &from = QString(), const QString &to = QString(), const QString &body = QString(), const QString &thread = QString()); @@ -220,8 +215,8 @@ public: void setMixUserNick(const QString &); // XEP-0380: Explicit Message Encryption - EncryptionMethod encryptionMethod() const; - void setEncryptionMethod(EncryptionMethod); + QXmpp::Encryption encryptionMethod() const; + void setEncryptionMethod(QXmpp::Encryption); QString encryptionMethodNs() const; void setEncryptionMethodNs(const QString &); -- cgit v1.2.3