QXmpp: QXmppRosterIq.h Source File

QXmpp Version: 1.14.4

Loading...
Searching...
No Matches
QXmppRosterIq.h
1// SPDX-FileCopyrightText: 2009 Manjeet Dahiya <manjeetdahiya@gmail.com>
2// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
3//
4// SPDX-License-Identifier: LGPL-2.1-or-later
5
6#ifndef QXMPPROSTERIQ_H
7#define QXMPPROSTERIQ_H
8
9#include "QXmppConstants_p.h"
10#include "QXmppIq.h"
11
12#include <QList>
13#include <QSet>
14#include <QSharedDataPointer>
15
16namespace QXmpp::Private {
17struct RosterData;
18}
19
20class QXmppRosterIqPrivate;
21
27 class QXMPP_EXPORT QXmppRosterIq : public QXmppIq
28{
29public:
30 class ItemPrivate;
31
33 class QXMPP_EXPORT Item
34 {
35 public:
37 enum SubscriptionType {
38 None = 0,
41 From = 1,
43 To = 2,
45 Both = 3,
47 Remove = 4,
48 NotSet = 8
49 };
50
51 Item();
52 Item(const Item &other);
53 Item(Item &&);
54 ~Item();
55
56 Item &operator=(const Item &other);
57 Item &operator=(Item &&);
58
59 QString bareJid() const;
60 QSet<QString> groups() const;
61 QString name() const;
62 QString subscriptionStatus() const;
63 SubscriptionType subscriptionType() const;
64 bool isApproved() const;
65
66 void setBareJid(const QString &);
67 void setGroups(const QSet<QString> &);
68 void setName(const QString &);
69 void setSubscriptionStatus(const QString &);
70 void setSubscriptionType(SubscriptionType);
71 void setIsApproved(bool);
72
73 // XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements
74 bool isMixChannel() const;
75 void setIsMixChannel(bool);
76
77 QString mixParticipantId() const;
78 void setMixParticipantId(const QString &);
79
81 static constexpr std::tuple XmlTag = { u"item", QXmpp::Private::ns_roster };
82 void parse(const QDomElement &element);
83 void toXml(QXmlStreamWriter *writer) const;
85
86 private:
87 friend struct QXmpp::Private::RosterData;
88
89 void toXml(QXmlStreamWriter *writer, bool external) const;
90
91 QString getSubscriptionTypeStr() const;
92 void setSubscriptionTypeFromStr(const QString &);
93
94 QSharedDataPointer<ItemPrivate> d;
95 };
96
97 QXmppRosterIq();
98 QXmppRosterIq(const QXmppRosterIq &);
99 QXmppRosterIq(QXmppRosterIq &&);
100 ~QXmppRosterIq() override;
101
102 QXmppRosterIq &operator=(const QXmppRosterIq &);
103 QXmppRosterIq &operator=(QXmppRosterIq &&);
104
105 QString version() const;
106 void setVersion(const QString &);
107
108 QList<Item> items() const;
109 void setItems(const QList<Item> &);
110 void addItem(const Item &);
111
112 // XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements
113 bool mixAnnotate() const;
114 void setMixAnnotate(bool);
115
117 static constexpr std::tuple PayloadXmlTag = { u"query", QXmpp::Private::ns_roster };
118 [[deprecated("Use QXmpp::isIqElement()")]]
119 static bool isRosterIq(const QDomElement &element);
121
122protected:
124 void parseElementFromChild(const QDomElement &element) override;
125 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
127
128private:
129 QSharedDataPointer<QXmppRosterIqPrivate> d;
130};
131
132#endif // QXMPPROSTERIQ_H
QXmppIq::QXmppIq
QXmppIq(QXmppIq::Type type=QXmppIq::Get)
Definition QXmppIq.cpp:39
QXmppNonza::parse
virtual void parse(const QDomElement &)=0
QXmppNonza::toXml
virtual void toXml(QXmlStreamWriter *writer) const =0
QXmppRosterIq::Item
The QXmppRosterIq::Item class represents a roster entry.
Definition QXmppRosterIq.h:34
QXmppRosterIq::Item::SubscriptionType
SubscriptionType
An enumeration for type of subscription with the bareJid in the roster.
Definition QXmppRosterIq.h:37
QXmppRosterIq::Item::From
@ From
Definition QXmppRosterIq.h:41
QXmppRosterIq::Item::Remove
@ Remove
to delete a roster item
Definition QXmppRosterIq.h:47
QXmppRosterIq::Item::None
@ None
Definition QXmppRosterIq.h:38
QXmppRosterIq::Item::NotSet
@ NotSet
the subscription state was not specified
Definition QXmppRosterIq.h:48
QXmppRosterIq::Item::Both
@ Both
Definition QXmppRosterIq.h:45
QXmppRosterIq::Item::To
@ To
Definition QXmppRosterIq.h:43
QXmppRosterIq::Item::subscriptionType
SubscriptionType subscriptionType() const
Definition QXmppRosterIq.cpp:268
QXmppRosterIq::Item::isApproved
bool isApproved() const
Definition QXmppRosterIq.cpp:288
QXmppRosterIq::Item::mixParticipantId
QString mixParticipantId() const
Definition QXmppRosterIq.cpp:373
QXmppRosterIq::Item::bareJid
QString bareJid() const
Definition QXmppRosterIq.cpp:186
QXmppRosterIq::Item::setMixParticipantId
void setMixParticipantId(const QString &)
Definition QXmppRosterIq.cpp:383
QXmppRosterIq::Item::setName
void setName(const QString &)
Definition QXmppRosterIq.cpp:235
QXmppRosterIq::Item::Item
Item()
Definition QXmppRosterIq.cpp:166
QXmppRosterIq::Item::setIsApproved
void setIsApproved(bool)
Definition QXmppRosterIq.cpp:302
QXmppRosterIq::Item::isMixChannel
bool isMixChannel() const
Definition QXmppRosterIq.cpp:353
QXmppRosterIq::Item::Item
Item(Item &&)
Default move-constructor.
QXmppRosterIq::Item::groups
QSet< QString > groups() const
Definition QXmppRosterIq.cpp:205
QXmppRosterIq::Item::operator=
Item & operator=(const Item &other)
Default assignment operator.
QXmppRosterIq::Item::setIsMixChannel
void setIsMixChannel(bool)
Definition QXmppRosterIq.cpp:363
QXmppRosterIq::Item::setSubscriptionType
void setSubscriptionType(SubscriptionType)
Definition QXmppRosterIq.cpp:278
QXmppRosterIq::Item::setBareJid
void setBareJid(const QString &)
Definition QXmppRosterIq.cpp:195
QXmppRosterIq::Item::operator=
Item & operator=(Item &&)
Default assignment operator.
QXmppRosterIq::Item::setGroups
void setGroups(const QSet< QString > &)
Definition QXmppRosterIq.cpp:215
QXmppRosterIq::Item::Item
Item(const Item &other)
Default copy-constructor.
QXmppRosterIq::Item::subscriptionStatus
QString subscriptionStatus() const
Definition QXmppRosterIq.cpp:247
QXmppRosterIq::Item::setSubscriptionStatus
void setSubscriptionStatus(const QString &)
Definition QXmppRosterIq.cpp:259
QXmppRosterIq::Item::name
QString name() const
Definition QXmppRosterIq.cpp:225
QXmppRosterIq
The QXmppRosterIq class represents a roster IQ.
Definition QXmppRosterIq.h:28
QXmppRosterIq::QXmppRosterIq
QXmppRosterIq(const QXmppRosterIq &)
Default copy-constructor.
QXmppRosterIq::operator=
QXmppRosterIq & operator=(const QXmppRosterIq &)
Default assignment operator.
QXmppRosterIq::setMixAnnotate
void setMixAnnotate(bool)
Definition QXmppRosterIq.cpp:113
QXmppRosterIq::setVersion
void setVersion(const QString &)
Definition QXmppRosterIq.cpp:92
QXmppRosterIq::operator=
QXmppRosterIq & operator=(QXmppRosterIq &&)
Default move-assignment operator.
QXmppRosterIq::items
QList< Item > items() const
Definition QXmppRosterIq.cpp:58
QXmppRosterIq::version
QString version() const
Definition QXmppRosterIq.cpp:80
QXmppRosterIq::addItem
void addItem(const Item &)
Definition QXmppRosterIq.cpp:50
QXmppRosterIq::setItems
void setItems(const QList< Item > &)
Definition QXmppRosterIq.cpp:68
QXmppRosterIq::QXmppRosterIq
QXmppRosterIq(QXmppRosterIq &&)
Default move-constructor.
QXmppRosterIq::mixAnnotate
bool mixAnnotate() const
Definition QXmppRosterIq.cpp:102