QXmpp Version: 1.10.0
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 "QXmppIq.h"
10
11#include <QList>
12#include <QSet>
13#include <QSharedDataPointer>
14
15namespace QXmpp::Private {
16struct RosterData;
17}
18
19class QXmppRosterIqPrivate;
20
26class QXMPP_EXPORT QXmppRosterIq : public QXmppIq
27{
28public:
29 class ItemPrivate;
30
32 class QXMPP_EXPORT Item
33 {
34 public:
37 None = 0,
40 From = 1,
42 To = 2,
44 Both = 3,
46 Remove = 4,
47 NotSet = 8
48 };
49
50 Item();
51 Item(const Item &other);
53 ~Item();
54
55 Item &operator=(const Item &other);
57
58 QString bareJid() const;
59 QSet<QString> groups() const;
60 QString name() const;
61 QString subscriptionStatus() const;
62 SubscriptionType subscriptionType() const;
63 bool isApproved() const;
64
65 void setBareJid(const QString &);
66 void setGroups(const QSet<QString> &);
67 void setName(const QString &);
68 void setSubscriptionStatus(const QString &);
69 void setSubscriptionType(SubscriptionType);
70 void setIsApproved(bool);
71
72 // XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements
73 bool isMixChannel() const;
74 void setIsMixChannel(bool);
75
76 QString mixParticipantId() const;
77 void setMixParticipantId(const QString &);
78
80 void parse(const QDomElement &element);
81 void toXml(QXmlStreamWriter *writer) const;
83
84 private:
85 friend struct QXmpp::Private::RosterData;
86
87 void toXml(QXmlStreamWriter *writer, bool external) const;
88
89 QString getSubscriptionTypeStr() const;
90 void setSubscriptionTypeFromStr(const QString &);
91
92 QSharedDataPointer<ItemPrivate> d;
93 };
94
98 ~QXmppRosterIq() override;
99
102
103 QString version() const;
104 void setVersion(const QString &);
105
106 QList<Item> items() const;
107 void setItems(const QList<Item> &);
108 void addItem(const Item &);
109
110 // XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements
111 bool mixAnnotate() const;
112 void setMixAnnotate(bool);
113
115 static bool isRosterIq(const QDomElement &element);
117
118protected:
120 void parseElementFromChild(const QDomElement &element) override;
121 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
123
124private:
125 QSharedDataPointer<QXmppRosterIqPrivate> d;
126};
127
128#endif // QXMPPROSTERIQ_H
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:23
virtual void parse(const QDomElement &)=0
virtual void toXml(QXmlStreamWriter *writer) const =0
The QXmppRosterIq::Item class represents a roster entry.
Definition: QXmppRosterIq.h:33
SubscriptionType
An enumeration for type of subscription with the bareJid in the roster.
Definition: QXmppRosterIq.h:36
Item(Item &&)
Default move-constructor.
Item & operator=(const Item &other)
Default assignment operator.
Item & operator=(Item &&)
Default assignment operator.
Item(const Item &other)
Default copy-constructor.
The QXmppRosterIq class represents a roster IQ.
Definition: QXmppRosterIq.h:27
QXmppRosterIq(const QXmppRosterIq &)
Default copy-constructor.
QXmppRosterIq & operator=(const QXmppRosterIq &)
Default assignment operator.
QXmppRosterIq & operator=(QXmppRosterIq &&)
Default move-assignment operator.
QXmppRosterIq(QXmppRosterIq &&)
Default move-constructor.