Loading...
Searching...
No Matches
QXmppPubSubSubscription.h
// SPDX-FileCopyrightText: 2020 Linus Jahn <lnj@kaidan.im>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef QXMPPPUBSUBSUBSCRIPTION_H
#define QXMPPPUBSUBSUBSCRIPTION_H
#include "QXmppGlobal.h"
#include <QDateTime>
#include <QMetaType>
#include <QSharedDataPointer>
class QXmppPubSubSubscriptionPrivate;
class QXmlStreamWriter;
class QDomElement;
class QXMPP_EXPORT QXmppPubSubSubscription
{
public:
enum State : uint8_t {
Invalid,
None,
Pending,
Subscribed,
Unconfigured,
};
static QString stateToString(State);
static State stateFromString(const QString &);
enum ConfigurationSupport : uint8_t {
Unavailable,
Available,
Required,
};
QXmppPubSubSubscription(const QString &jid = {},
const QString &node = {},
const QString &subId = {},
State state = Invalid,
ConfigurationSupport configurationSupport = Unavailable,
const QDateTime &expiry = {});
QXmppPubSubSubscription(const QXmppPubSubSubscription &);
QXmppPubSubSubscription(QXmppPubSubSubscription &&);
~QXmppPubSubSubscription();
QXmppPubSubSubscription &operator=(const QXmppPubSubSubscription &);
QXmppPubSubSubscription &operator=(QXmppPubSubSubscription &&);
QString jid() const;
void setJid(const QString &jid);
QString node() const;
void setNode(const QString &node);
QString subId() const;
void setSubId(const QString &subId);
QDateTime expiry() const;
void setExpiry(const QDateTime &expiry);
State state() const;
void setState(State state);
ConfigurationSupport configurationSupport() const;
void setConfigurationSupport(ConfigurationSupport support);
bool isConfigurationSupported() const;
bool isConfigurationRequired() const;
static bool isSubscription(const QDomElement &);
void parse(const QDomElement &);
void toXml(QXmlStreamWriter *writer) const;
private:
QSharedDataPointer<QXmppPubSubSubscriptionPrivate> d;
};
Q_DECLARE_TYPEINFO(QXmppPubSubSubscription, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(QXmppPubSubSubscription)
Q_DECLARE_METATYPE(QXmppPubSubSubscription::State)
Q_DECLARE_METATYPE(QXmppPubSubSubscription::ConfigurationSupport)
#endif // QXMPPPUBSUBSUBSCRIPTION_H
QXmppPubSubSubscription
Definition QXmppPubSubSubscription.h:19
QXmppPubSubSubscription::operator=
QXmppPubSubSubscription & operator=(const QXmppPubSubSubscription &)
Copy assignment operator.
QXmppPubSubSubscription::QXmppPubSubSubscription
QXmppPubSubSubscription(QXmppPubSubSubscription &&)
Move contructor.
QXmppPubSubSubscription::operator=
QXmppPubSubSubscription & operator=(QXmppPubSubSubscription &&)
Move-assignment operator.
QXmppPubSubSubscription::State
State
Definition QXmppPubSubSubscription.h:24
QXmppPubSubSubscription::Pending
@ Pending
A subscription is pending.
Definition QXmppPubSubSubscription.h:30
QXmppPubSubSubscription::Subscribed
@ Subscribed
The user is subscribed to the node.
Definition QXmppPubSubSubscription.h:32
QXmppPubSubSubscription::Unconfigured
@ Unconfigured
The subscription requires configuration before it becomes active.
Definition QXmppPubSubSubscription.h:34
QXmppPubSubSubscription::Invalid
@ Invalid
No state information is included.
Definition QXmppPubSubSubscription.h:26
QXmppPubSubSubscription::None
@ None
There is no subscription with the node.
Definition QXmppPubSubSubscription.h:28
QXmppPubSubSubscription::ConfigurationSupport
ConfigurationSupport
Definition QXmppPubSubSubscription.h:44
QXmppPubSubSubscription::Required
@ Required
Definition QXmppPubSubSubscription.h:52
QXmppPubSubSubscription::Available
@ Available
Configuration of the subscription is possible, but not required.
Definition QXmppPubSubSubscription.h:48
QXmppPubSubSubscription::Unavailable
@ Unavailable
A subscription configuration is not advertised.
Definition QXmppPubSubSubscription.h:46
QXmppPubSubSubscription::QXmppPubSubSubscription
QXmppPubSubSubscription(const QXmppPubSubSubscription &)
Copy contructor.