QXmpp Version: 1.5.6
Loading...
Searching...
No Matches
QXmppPubSubSubscription.h
1// SPDX-FileCopyrightText: 2020 Linus Jahn <lnj@kaidan.im>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPPUBSUBSUBSCRIPTION_H
6#define QXMPPPUBSUBSUBSCRIPTION_H
7
8#include "QXmppGlobal.h"
9
10#include <QDateTime>
11#include <QMetaType>
12#include <QSharedDataPointer>
13
14class QXmppPubSubSubscriptionPrivate;
15class QXmlStreamWriter;
16class QDomElement;
17
18class QXMPP_EXPORT QXmppPubSubSubscription
19{
20public:
36 static QString stateToString(State);
37 static State stateFromString(const QString &);
38
54
55 QXmppPubSubSubscription(const QString &jid = {},
56 const QString &node = {},
57 const QString &subId = {},
58 State state = Invalid,
59 ConfigurationSupport configurationSupport = Unavailable,
60 const QDateTime &expiry = {});
64
67
68 QString jid() const;
69 void setJid(const QString &jid);
70
71 QString node() const;
72 void setNode(const QString &node);
73
74 QString subId() const;
75 void setSubId(const QString &subId);
76
77 QDateTime expiry() const;
78 void setExpiry(const QDateTime &expiry);
79
80 State state() const;
81 void setState(State state);
82
83 ConfigurationSupport configurationSupport() const;
84 void setConfigurationSupport(ConfigurationSupport support);
85 bool isConfigurationSupported() const;
86 bool isConfigurationRequired() const;
87
88 static bool isSubscription(const QDomElement &);
89
91 void parse(const QDomElement &);
92 void toXml(QXmlStreamWriter *writer) const;
94
95private:
96 QSharedDataPointer<QXmppPubSubSubscriptionPrivate> d;
97};
98
99Q_DECLARE_TYPEINFO(QXmppPubSubSubscription, Q_MOVABLE_TYPE);
100Q_DECLARE_METATYPE(QXmppPubSubSubscription)
101Q_DECLARE_METATYPE(QXmppPubSubSubscription::State)
103
104#endif // QXMPPPUBSUBSUBSCRIPTION_H
Definition QXmppPubSubSubscription.h:19
QXmppPubSubSubscription & operator=(const QXmppPubSubSubscription &)
Copy assignment operator.
QXmppPubSubSubscription(QXmppPubSubSubscription &&)
Move contructor.
QXmppPubSubSubscription & operator=(QXmppPubSubSubscription &&)
Move-assignment operator.
State
Definition QXmppPubSubSubscription.h:24
@ Pending
A subscription is pending.
Definition QXmppPubSubSubscription.h:30
@ Subscribed
The user is subscribed to the node.
Definition QXmppPubSubSubscription.h:32
@ Unconfigured
The subscription requires configuration before it becomes active.
Definition QXmppPubSubSubscription.h:34
@ Invalid
No state information is included.
Definition QXmppPubSubSubscription.h:26
@ None
There is no subscription with the node.
Definition QXmppPubSubSubscription.h:28
ConfigurationSupport
Definition QXmppPubSubSubscription.h:44
@ Required
Definition QXmppPubSubSubscription.h:52
@ Available
Configuration of the subscription is possible, but not required.
Definition QXmppPubSubSubscription.h:48
@ Unavailable
A subscription configuration is not advertised.
Definition QXmppPubSubSubscription.h:46
QXmppPubSubSubscription(const QXmppPubSubSubscription &)
Copy contructor.