QXmpp  Version:1.3.1
QXmppDiscoveryIq.h
1 /*
2  * Copyright (C) 2008-2020 The QXmpp developers
3  *
4  * Author:
5  * Jeremy LainĂ©
6  *
7  * Source:
8  * https://github.com/qxmpp-project/qxmpp
9  *
10  * This file is a part of QXmpp library.
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  */
23 
24 #ifndef QXMPPDISCOVERY_H
25 #define QXMPPDISCOVERY_H
26 
27 #include "QXmppDataForm.h"
28 #include "QXmppIq.h"
29 
30 #include <QSharedDataPointer>
31 
32 class QXmppDiscoveryIdentityPrivate;
33 class QXmppDiscoveryItemPrivate;
34 class QXmppDiscoveryIqPrivate;
35 
43 class QXMPP_EXPORT QXmppDiscoveryIq : public QXmppIq
44 {
45 public:
51  class QXMPP_EXPORT Identity
52  {
53  public:
54  Identity();
55  Identity(const Identity &other);
56  ~Identity();
57 
58  Identity &operator=(const Identity &other);
59 
60  QString category() const;
61  void setCategory(const QString &category);
62 
63  QString language() const;
64  void setLanguage(const QString &language);
65 
66  QString name() const;
67  void setName(const QString &name);
68 
69  QString type() const;
70  void setType(const QString &type);
71 
72  private:
73  QSharedDataPointer<QXmppDiscoveryIdentityPrivate> d;
74  };
75 
80  class QXMPP_EXPORT Item
81  {
82  public:
83  Item();
84  Item(const Item &);
85  ~Item();
86 
87  Item &operator=(const Item &);
88 
89  QString jid() const;
90  void setJid(const QString &jid);
91 
92  QString name() const;
93  void setName(const QString &name);
94 
95  QString node() const;
96  void setNode(const QString &node);
97 
98  private:
99  QSharedDataPointer<QXmppDiscoveryItemPrivate> d;
100  };
101 
104  ~QXmppDiscoveryIq();
105 
106  QXmppDiscoveryIq &operator=(const QXmppDiscoveryIq &);
107 
108  enum QueryType {
109  InfoQuery,
110  ItemsQuery
111  };
112 
113  QStringList features() const;
114  void setFeatures(const QStringList &features);
115 
116  QList<QXmppDiscoveryIq::Identity> identities() const;
117  void setIdentities(const QList<QXmppDiscoveryIq::Identity> &identities);
118 
119  QList<QXmppDiscoveryIq::Item> items() const;
120  void setItems(const QList<QXmppDiscoveryIq::Item> &items);
121 
122  QXmppDataForm form() const;
123  void setForm(const QXmppDataForm &form);
124 
125  QString queryNode() const;
126  void setQueryNode(const QString &node);
127 
128  enum QueryType queryType() const;
129  void setQueryType(enum QueryType type);
130 
131  QByteArray verificationString() const;
132 
133  static bool isDiscoveryIq(const QDomElement &element);
134 
135 protected:
137  void parseElementFromChild(const QDomElement &element) override;
138  void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
140 
141 private:
142  QSharedDataPointer<QXmppDiscoveryIqPrivate> d;
143 };
144 
145 #endif
QXmppDiscoveryIq::Item
Item represents a related XMPP entity that can be queried using XEP-0030: Service Discovery.
Definition: QXmppDiscoveryIq.h:80
QXmppDataForm
The QXmppDataForm class represents a data form as defined by XEP-0004: Data Forms.
Definition: QXmppDataForm.h:48
QXmppDiscoveryIq::Identity
Identity represents one of possibly multiple identities of an XMPP entity obtained from a service dis...
Definition: QXmppDiscoveryIq.h:51
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:41
QXmppDiscoveryIq
QXmppDiscoveryIq represents a discovery IQ request or result containing a list of features and other ...
Definition: QXmppDiscoveryIq.h:43