QXmpp  Version:1.2.0
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 
36 class QXMPP_EXPORT QXmppDiscoveryIq : public QXmppIq
37 {
38 public:
39  class QXMPP_EXPORT Identity
40  {
41  public:
42  Identity();
43  Identity(const Identity &other);
44  ~Identity();
45 
46  Identity &operator=(const Identity &other);
47 
48  QString category() const;
49  void setCategory(const QString &category);
50 
51  QString language() const;
52  void setLanguage(const QString &language);
53 
54  QString name() const;
55  void setName(const QString &name);
56 
57  QString type() const;
58  void setType(const QString &type);
59 
60  private:
61  QSharedDataPointer<QXmppDiscoveryIdentityPrivate> d;
62  };
63 
64  class QXMPP_EXPORT Item
65  {
66  public:
67  Item();
68  Item(const Item &);
69  ~Item();
70 
71  Item &operator=(const Item &);
72 
73  QString jid() const;
74  void setJid(const QString &jid);
75 
76  QString name() const;
77  void setName(const QString &name);
78 
79  QString node() const;
80  void setNode(const QString &node);
81 
82  private:
83  QSharedDataPointer<QXmppDiscoveryItemPrivate> d;
84  };
85 
86  QXmppDiscoveryIq();
87  QXmppDiscoveryIq(const QXmppDiscoveryIq &);
88  ~QXmppDiscoveryIq();
89 
90  QXmppDiscoveryIq &operator=(const QXmppDiscoveryIq &);
91 
92  enum QueryType {
93  InfoQuery,
94  ItemsQuery
95  };
96 
97  QStringList features() const;
98  void setFeatures(const QStringList &features);
99 
100  QList<QXmppDiscoveryIq::Identity> identities() const;
101  void setIdentities(const QList<QXmppDiscoveryIq::Identity> &identities);
102 
103  QList<QXmppDiscoveryIq::Item> items() const;
104  void setItems(const QList<QXmppDiscoveryIq::Item> &items);
105 
106  QXmppDataForm form() const;
107  void setForm(const QXmppDataForm &form);
108 
109  QString queryNode() const;
110  void setQueryNode(const QString &node);
111 
112  enum QueryType queryType() const;
113  void setQueryType(enum QueryType type);
114 
115  QByteArray verificationString() const;
116 
117  static bool isDiscoveryIq(const QDomElement &element);
118 
119 protected:
121  void parseElementFromChild(const QDomElement &element) override;
122  void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
124 
125 private:
126  QSharedDataPointer<QXmppDiscoveryIqPrivate> d;
127 };
128 
129 #endif
QXmppDataForm
The QXmppDataForm class represents a data form as defined by XEP-0004: Data Forms.
Definition: QXmppDataForm.h:47
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:41