From 4a146238b0ddaed6e59f92c0f75536695a9f6b6c Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Sun, 22 May 2022 18:14:54 +0200 Subject: Add SendStanzaParams for passing additional parameters For now only contains a list of JIDs the stanza should be encrypted for. --- src/client/QXmppSendStanzaParams.cpp | 54 ++++++++++++++++++++++++++++++++++++ src/client/QXmppSendStanzaParams.h | 29 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 src/client/QXmppSendStanzaParams.cpp create mode 100644 src/client/QXmppSendStanzaParams.h (limited to 'src/client') 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 +// +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include "QXmppSendStanzaParams.h" + +#include + +/// +/// \class QXmppSendStanzaParams +/// +/// Contains additional parameters for sending stanzas. +/// +/// \since QXmpp 1.5 +/// + +class QXmppSendStanzaParamsPrivate : public QSharedData +{ +public: + QVector 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 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 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 +// +// SPDX-License-Identifier: LGPL-2.1-or-later + +#ifndef QXMPPSENDSTANZAPARAMS_H +#define QXMPPSENDSTANZAPARAMS_H + +#include "QXmppGlobal.h" + +#include + +class QXmppSendStanzaParamsPrivate; + +class QXMPP_EXPORT QXmppSendStanzaParams +{ +public: + QXmppSendStanzaParams(); + QXmppSendStanzaParams(const QXmppSendStanzaParams &other); + ~QXmppSendStanzaParams(); + QXmppSendStanzaParams &operator=(const QXmppSendStanzaParams &); + + QVector encryptionJids() const; + void sendEncryptionJids(QVector); + +private: + QSharedDataPointer d; +}; + +#endif // QXMPPSENDSTANZAPARAMS_H -- cgit v1.2.3