diff options
| author | Linus Jahn <lnj@kaidan.im> | 2020-07-06 00:27:25 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2021-08-22 16:09:02 +0200 |
| commit | ecfa45db97e40ad7034a3cce4d26b3db87eb5c10 (patch) | |
| tree | 936928e05f5e9242ea706b39b1862735138073f0 /src/base/QXmppPubSubAffiliation.h | |
| parent | 086f366d800bd93563742426533848dc24aa6f30 (diff) | |
| download | qxmpp-ecfa45db97e40ad7034a3cce4d26b3db87eb5c10.tar.gz | |
Add QXmppPubSubAffiliation
Diffstat (limited to 'src/base/QXmppPubSubAffiliation.h')
| -rw-r--r-- | src/base/QXmppPubSubAffiliation.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/base/QXmppPubSubAffiliation.h b/src/base/QXmppPubSubAffiliation.h new file mode 100644 index 00000000..863a0171 --- /dev/null +++ b/src/base/QXmppPubSubAffiliation.h @@ -0,0 +1,83 @@ +/* + * 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 QXMPPPUBSUBAFFILIATION_H +#define QXMPPPUBSUBAFFILIATION_H + +#include "QXmppGlobal.h" + +#include <QMetaType> +#include <QSharedDataPointer> + +class QXmppPubSubAffiliationPrivate; +class QDomElement; +class QXmlStreamWriter; + +class QXMPP_EXPORT QXmppPubSubAffiliation +{ +public: + /// + /// This enum describes the type of the affiliation of the user with the + /// node. + /// + enum Affiliation { + None, ///< No affiliation, but may subscribe. + Member, ///< Active member, is subscribed, can read. + Outcast, ///< Cannot subscribe, cannot read, 'banned'. + Owner, ///< Highest privileges, can read, publish & configure. + Publisher, ///< May read and publish, but cannot configure node. + PublishOnly, ///< Can only publish, cannot subscribe. + }; + + QXmppPubSubAffiliation(Affiliation = None, + const QString &node = {}, + const QString &jid = {}); + QXmppPubSubAffiliation(const QXmppPubSubAffiliation &); + ~QXmppPubSubAffiliation(); + + QXmppPubSubAffiliation &operator=(const QXmppPubSubAffiliation &); + + Affiliation type() const; + void setType(Affiliation type); + + QString node() const; + void setNode(const QString &node); + + QString jid() const; + void setJid(const QString &jid); + + static bool isAffiliation(const QDomElement &); + + /// \cond + void parse(const QDomElement &); + void toXml(QXmlStreamWriter *) const; + /// \endcond + +private: + QSharedDataPointer<QXmppPubSubAffiliationPrivate> d; +}; + +Q_DECLARE_METATYPE(QXmppPubSubAffiliation) +Q_DECLARE_METATYPE(QXmppPubSubAffiliation::Affiliation) + +#endif // QXMPPPUBSUBAFFILIATION_H |
