diff options
| author | Linus Jahn <lnj@kaidan.im> | 2022-05-22 18:14:54 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2022-05-22 19:35:56 +0200 |
| commit | 4a146238b0ddaed6e59f92c0f75536695a9f6b6c (patch) | |
| tree | e212e79f6fa07eeb42dffa790aca4199f640620c /src | |
| parent | 9e96ab61349e313bf91035b3872a89510bfeee2f (diff) | |
| download | qxmpp-4a146238b0ddaed6e59f92c0f75536695a9f6b6c.tar.gz | |
Add SendStanzaParams for passing additional parameters
For now only contains a list of JIDs the stanza should be encrypted for.
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/client/QXmppSendStanzaParams.cpp | 54 | ||||
| -rw-r--r-- | src/client/QXmppSendStanzaParams.h | 29 |
3 files changed, 85 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 767c51fb..25c6fddd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -113,6 +113,7 @@ set(INSTALL_HEADER_FILES client/QXmppRemoteMethod.h client/QXmppRosterManager.h client/QXmppRpcManager.h + client/QXmppSendStanzaParams.h client/QXmppTransferManager.h client/QXmppTransferManager_p.h client/QXmppTrustManager.h @@ -225,6 +226,7 @@ set(SOURCE_FILES client/QXmppPubSubEventManager.h # for MOC client/QXmppRemoteMethod.cpp client/QXmppRpcManager.cpp + client/QXmppSendStanzaParams.cpp client/QXmppTlsManager.cpp client/QXmppTransferManager.cpp client/QXmppTrustManager.cpp diff --git a/src/client/QXmppSendStanzaParams.cpp b/src/client/QXmppSendStanzaParams.cpp new file mode 100644 index 00000000..afbcdbc6 --- /dev/null +++ b/src/client/QXmppSendStanzaParams.cpp @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: 2022 Linus Jahn <lnj@kaidan.im> +// +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include "QXmppSendStanzaParams.h" + +#include <QVector> + +/// +/// \class QXmppSendStanzaParams +/// +/// Contains additional parameters for sending stanzas. +/// +/// \since QXmpp 1.5 +/// + +class QXmppSendStanzaParamsPrivate : public QSharedData +{ +public: + QVector<QString> encryptionJids; +}; + +QXmppSendStanzaParams::QXmppSendStanzaParams() + : d(new QXmppSendStanzaParamsPrivate) +{ +} + +/// Copy-constructor +QXmppSendStanzaParams::QXmppSendStanzaParams(const QXmppSendStanzaParams &other) = default; +QXmppSendStanzaParams::~QXmppSendStanzaParams() = default; +/// Assignment operator +QXmppSendStanzaParams &QXmppSendStanzaParams::operator=(const QXmppSendStanzaParams &) = default; + +/// +/// Returns the list of JIDs that the stanza should be encrypted for. +/// +/// If this is empty, the stanza should be encrypted for the recipient. +/// This option is useful for groupchats. +/// +QVector<QString> QXmppSendStanzaParams::encryptionJids() const +{ + return d->encryptionJids; +} + +/// +/// Sets the list of JIDs that the stanza should be encrypted for. +/// +/// If this is empty, the stanza should be encrypted for the recipient. +/// This option is useful for groupchats. +/// +void QXmppSendStanzaParams::sendEncryptionJids(QVector<QString> encryptionJids) +{ + d->encryptionJids = std::move(encryptionJids); +} diff --git a/src/client/QXmppSendStanzaParams.h b/src/client/QXmppSendStanzaParams.h new file mode 100644 index 00000000..0b222b45 --- /dev/null +++ b/src/client/QXmppSendStanzaParams.h @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2022 Linus Jahn <lnj@kaidan.im> +// +// SPDX-License-Identifier: LGPL-2.1-or-later + +#ifndef QXMPPSENDSTANZAPARAMS_H +#define QXMPPSENDSTANZAPARAMS_H + +#include "QXmppGlobal.h" + +#include <QSharedDataPointer> + +class QXmppSendStanzaParamsPrivate; + +class QXMPP_EXPORT QXmppSendStanzaParams +{ +public: + QXmppSendStanzaParams(); + QXmppSendStanzaParams(const QXmppSendStanzaParams &other); + ~QXmppSendStanzaParams(); + QXmppSendStanzaParams &operator=(const QXmppSendStanzaParams &); + + QVector<QString> encryptionJids() const; + void sendEncryptionJids(QVector<QString>); + +private: + QSharedDataPointer<QXmppSendStanzaParamsPrivate> d; +}; + +#endif // QXMPPSENDSTANZAPARAMS_H |
