QXmpp  Version:1.3.1
QXmppRosterIq.h
1 /*
2  * Copyright (C) 2008-2020 The QXmpp developers
3  *
4  * Authors:
5  * Manjeet Dahiya
6  * Jeremy LainĂ©
7  *
8  * Source:
9  * https://github.com/qxmpp-project/qxmpp
10  *
11  * This file is a part of QXmpp library.
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public
15  * License as published by the Free Software Foundation; either
16  * version 2.1 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  * Lesser General Public License for more details.
22  *
23  */
24 
25 #ifndef QXMPPROSTERIQ_H
26 #define QXMPPROSTERIQ_H
27 
28 #include "QXmppIq.h"
29 
30 #include <QList>
31 #include <QSet>
32 #include <QSharedDataPointer>
33 
34 class QXmppRosterIqPrivate;
35 
39 
40 class QXMPP_EXPORT QXmppRosterIq : public QXmppIq
41 {
42 public:
43  class ItemPrivate;
44 
46  class QXMPP_EXPORT Item
47  {
48  public:
51  None = 0,
52  From = 1,
55  To = 2,
57  Both = 3,
59  Remove = 4,
61  NotSet = 8
62  };
63 
64  Item();
65  Item(const Item &other);
66  ~Item();
67 
68  Item &operator=(const Item &other);
69 
70  QString bareJid() const;
71  QSet<QString> groups() const;
72  QString name() const;
73  QString subscriptionStatus() const;
74  SubscriptionType subscriptionType() const;
75  bool isApproved() const;
76 
77  void setBareJid(const QString &);
78  void setGroups(const QSet<QString> &);
79  void setName(const QString &);
80  void setSubscriptionStatus(const QString &);
81  void setSubscriptionType(SubscriptionType);
82  void setIsApproved(bool);
83 
84  // XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements
85  bool isMixChannel() const;
86  void setIsMixChannel(bool);
87 
88  QString mixParticipantId() const;
89  void setMixParticipantId(const QString &);
90 
92  void parse(const QDomElement &element);
93  void toXml(QXmlStreamWriter *writer) const;
95 
96  private:
97  QString getSubscriptionTypeStr() const;
98  void setSubscriptionTypeFromStr(const QString &);
99 
100  QSharedDataPointer<ItemPrivate> d;
101  };
102 
103  QXmppRosterIq();
104  QXmppRosterIq(const QXmppRosterIq &);
105  ~QXmppRosterIq() override;
106 
107  QXmppRosterIq &operator=(const QXmppRosterIq &);
108 
109  QString version() const;
110  void setVersion(const QString &);
111 
112  void addItem(const Item &);
113  QList<Item> items() const;
114 
115  // XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements
116  bool mixAnnotate() const;
117  void setMixAnnotate(bool);
118 
120  static bool isRosterIq(const QDomElement &element);
122 
123 protected:
125  void parseElementFromChild(const QDomElement &element) override;
126  void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
128 
129 private:
130  QSharedDataPointer<QXmppRosterIqPrivate> d;
131 };
132 
133 #endif // QXMPPROSTERIQ_H
QXmppRosterIq::Item
The QXmppRosterIq::Item class represents a roster entry.
Definition: QXmppRosterIq.h:46
QXmppRosterIq::Item::SubscriptionType
SubscriptionType
An enumeration for type of subscription with the bareJid in the roster.
Definition: QXmppRosterIq.h:50
QXmppRosterIq
The QXmppRosterIq class represents a roster IQ.
Definition: QXmppRosterIq.h:40
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:41