diff options
| author | Linus Jahn <lnj@kaidan.im> | 2020-09-07 16:53:36 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2021-08-22 16:09:02 +0200 |
| commit | daa3385a3d0b14202cb6cdadaaca72c93614ecc6 (patch) | |
| tree | 33cf937e412742fc707f5ef1b5ada25510a4d4c7 /src/base/QXmppPubSubMetadata.h | |
| parent | 66ee49093aec057c783edf9a39689af7b2bd8488 (diff) | |
| download | qxmpp-daa3385a3d0b14202cb6cdadaaca72c93614ecc6.tar.gz | |
Add PubSubMetadata form
Diffstat (limited to 'src/base/QXmppPubSubMetadata.h')
| -rw-r--r-- | src/base/QXmppPubSubMetadata.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/base/QXmppPubSubMetadata.h b/src/base/QXmppPubSubMetadata.h new file mode 100644 index 00000000..fb0590ec --- /dev/null +++ b/src/base/QXmppPubSubMetadata.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2008-2021 The QXmpp developers + * + * Author: + * Linus Jahn + * + * Source: + * https://github.com/qxmpp-project/qxmpp + * + * This file is a part of QXmpp library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + */ + +#ifndef QXMPPPUBSUBMETADATA_H +#define QXMPPPUBSUBMETADATA_H + +#include "QXmppDataFormBase.h" +#include "QXmppPubSubNodeConfig.h" + +#include <variant> + +class QXmppPubSubMetadataPrivate; + +class QXMPP_EXPORT QXmppPubSubMetadata : public QXmppExtensibleDataFormBase +{ +public: + struct Unset { + }; + struct Max { + }; + using ItemLimit = std::variant<Unset, quint64, Max>; + + QXmppPubSubMetadata(); + QXmppPubSubMetadata(const QXmppPubSubMetadata &); + ~QXmppPubSubMetadata(); + + QXmppPubSubMetadata &operator=(const QXmppPubSubMetadata &); + + QStringList contactJids() const; + void setContactJids(const QStringList &contactJids); + + QDateTime creationDate() const; + void setCreationDate(const QDateTime &creationDate); + + QString creatorJid() const; + void setCreatorJid(const QString &creatorJid); + + QString description() const; + void setDescription(const QString &description); + + QString language() const; + void setLanguage(const QString &language); + + std::optional<QXmppPubSubNodeConfig::AccessModel> accessModel() const; + void setAccessModel(std::optional<QXmppPubSubNodeConfig::AccessModel> accessModel); + + std::optional<QXmppPubSubNodeConfig::PublishModel> publishModel() const; + void setPublishModel(std::optional<QXmppPubSubNodeConfig::PublishModel> publishModel); + + std::optional<quint64> numberOfSubscribers() const; + void setNumberOfSubscribers(const std::optional<quint64> &numberOfSubscribers); + + QStringList ownerJids() const; + void setOwnerJids(const QStringList &ownerJids); + + QStringList publisherJids() const; + void setPublisherJids(const QStringList &publisherJids); + + QString title() const; + void setTitle(const QString &title); + + QString type() const; + void setType(const QString &type); + + ItemLimit maxItems() const; + void setMaxItems(ItemLimit maxItems); + +protected: + QString formType() const override; + bool parseField(const QXmppDataForm::Field &) override; + void serializeForm(QXmppDataForm &) const override; + +private: + QSharedDataPointer<QXmppPubSubMetadataPrivate> d; +}; + +#endif // QXMPPPUBSUBMETADATA_H |
