QXmpp: QXmppPubSubSubscription.h Source File

QXmpp Version: 1.14.4

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
18 class QXMPP_EXPORT QXmppPubSubSubscription
19{
20public:
24 enum State : uint8_t {
26 Invalid,
28 None,
30 Pending,
32 Subscribed,
34 Unconfigured,
35 };
36
42 enum ConfigurationSupport : uint8_t {
44 Unavailable,
46 Available,
50 Required,
51 };
52
53 QXmppPubSubSubscription(const QString &jid = {},
54 const QString &node = {},
55 const QString &subId = {},
56 State state = Invalid,
57 ConfigurationSupport configurationSupport = Unavailable,
58 const QDateTime &expiry = {});
59 QXmppPubSubSubscription(const QXmppPubSubSubscription &);
60 QXmppPubSubSubscription(QXmppPubSubSubscription &&);
61 ~QXmppPubSubSubscription();
62
63 QXmppPubSubSubscription &operator=(const QXmppPubSubSubscription &);
64 QXmppPubSubSubscription &operator=(QXmppPubSubSubscription &&);
65
66 QString jid() const;
67 void setJid(const QString &jid);
68
69 QString node() const;
70 void setNode(const QString &node);
71
72 QString subId() const;
73 void setSubId(const QString &subId);
74
75 QDateTime expiry() const;
76 void setExpiry(const QDateTime &expiry);
77
78 State state() const;
79 void setState(State state);
80
81 ConfigurationSupport configurationSupport() const;
82 void setConfigurationSupport(ConfigurationSupport support);
83 bool isConfigurationSupported() const;
84 bool isConfigurationRequired() const;
85
86 static bool isSubscription(const QDomElement &);
87
89 void parse(const QDomElement &);
90 void toXml(QXmlStreamWriter *writer) const;
92
93private:
94 QSharedDataPointer<QXmppPubSubSubscriptionPrivate> d;
95};
96
97Q_DECLARE_TYPEINFO(QXmppPubSubSubscription, Q_MOVABLE_TYPE);
98Q_DECLARE_METATYPE(QXmppPubSubSubscription)
99Q_DECLARE_METATYPE(QXmppPubSubSubscription::State)
100Q_DECLARE_METATYPE(QXmppPubSubSubscription::ConfigurationSupport)
101
102#endif // QXMPPPUBSUBSUBSCRIPTION_H
QXmppPubSubSubscription
Definition QXmppPubSubSubscription.h:19
QXmppPubSubSubscription::setConfigurationSupport
void setConfigurationSupport(ConfigurationSupport support)
Definition QXmppPubSubSubscription.cpp:205
QXmppPubSubSubscription::isConfigurationSupported
bool isConfigurationSupported() const
Definition QXmppPubSubSubscription.cpp:213
QXmppPubSubSubscription::operator=
QXmppPubSubSubscription & operator=(const QXmppPubSubSubscription &)
Copy assignment operator.
QXmppPubSubSubscription::isSubscription
static bool isSubscription(const QDomElement &)
Definition QXmppPubSubSubscription.cpp:230
QXmppPubSubSubscription::jid
QString jid() const
Definition QXmppPubSubSubscription.cpp:111
QXmppPubSubSubscription::isConfigurationRequired
bool isConfigurationRequired() const
Definition QXmppPubSubSubscription.cpp:222
QXmppPubSubSubscription::QXmppPubSubSubscription
QXmppPubSubSubscription(QXmppPubSubSubscription &&)
Move contructor.
QXmppPubSubSubscription::configurationSupport
ConfigurationSupport configurationSupport() const
Definition QXmppPubSubSubscription.cpp:197
QXmppPubSubSubscription::subId
QString subId() const
Definition QXmppPubSubSubscription.cpp:143
QXmppPubSubSubscription::node
QString node() const
Definition QXmppPubSubSubscription.cpp:127
QXmppPubSubSubscription::QXmppPubSubSubscription
QXmppPubSubSubscription(const QString &jid={}, const QString &node={}, const QString &subId={}, State state=Invalid, ConfigurationSupport configurationSupport=Unavailable, const QDateTime &expiry={})
Definition QXmppPubSubSubscription.cpp:88
QXmppPubSubSubscription::state
State state() const
Definition QXmppPubSubSubscription.cpp:159
QXmppPubSubSubscription::expiry
QDateTime expiry() const
Definition QXmppPubSubSubscription.cpp:178
QXmppPubSubSubscription::setJid
void setJid(const QString &jid)
Definition QXmppPubSubSubscription.cpp:119
QXmppPubSubSubscription::setSubId
void setSubId(const QString &subId)
Definition QXmppPubSubSubscription.cpp:151
QXmppPubSubSubscription::operator=
QXmppPubSubSubscription & operator=(QXmppPubSubSubscription &&)
Move-assignment operator.
QXmppPubSubSubscription::setNode
void setNode(const QString &node)
Definition QXmppPubSubSubscription.cpp:135
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:42
QXmppPubSubSubscription::Required
@ Required
Definition QXmppPubSubSubscription.h:50
QXmppPubSubSubscription::Available
@ Available
Configuration of the subscription is possible, but not required.
Definition QXmppPubSubSubscription.h:46
QXmppPubSubSubscription::Unavailable
@ Unavailable
A subscription configuration is not advertised.
Definition QXmppPubSubSubscription.h:44
QXmppPubSubSubscription::setState
void setState(State state)
Definition QXmppPubSubSubscription.cpp:167
QXmppPubSubSubscription::setExpiry
void setExpiry(const QDateTime &expiry)
Definition QXmppPubSubSubscription.cpp:189
QXmppPubSubSubscription::QXmppPubSubSubscription
QXmppPubSubSubscription(const QXmppPubSubSubscription &)
Copy contructor.