QXmpp  Version:0.9.1
QXmppDiscoveryIq.h
1 /*
2  * Copyright (C) 2008-2014 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 class QXMPP_EXPORT QXmppDiscoveryIq : public QXmppIq
31 {
32 public:
33  class QXMPP_EXPORT Identity
34  {
35  public:
36  QString category() const;
37  void setCategory(const QString &category);
38 
39  QString language() const;
40  void setLanguage(const QString &language);
41 
42  QString name() const;
43  void setName(const QString &name);
44 
45  QString type() const;
46  void setType(const QString &type);
47 
48  private:
49  QString m_category;
50  QString m_language;
51  QString m_name;
52  QString m_type;
53  };
54 
55  class QXMPP_EXPORT Item
56  {
57  public:
58  QString jid() const;
59  void setJid(const QString &jid);
60 
61  QString name() const;
62  void setName(const QString &name);
63 
64  QString node() const;
65  void setNode(const QString &node);
66 
67  private:
68  QString m_jid;
69  QString m_name;
70  QString m_node;
71  };
72 
73  enum QueryType {
74  InfoQuery,
75  ItemsQuery
76  };
77 
78  QStringList features() const;
79  void setFeatures(const QStringList &features);
80 
81  QList<QXmppDiscoveryIq::Identity> identities() const;
82  void setIdentities(const QList<QXmppDiscoveryIq::Identity> &identities);
83 
84  QList<QXmppDiscoveryIq::Item> items() const;
85  void setItems(const QList<QXmppDiscoveryIq::Item> &items);
86 
87  QXmppDataForm form() const;
88  void setForm(const QXmppDataForm &form);
89 
90  QString queryNode() const;
91  void setQueryNode(const QString &node);
92 
93  enum QueryType queryType() const;
94  void setQueryType(enum QueryType type);
95 
96  QByteArray verificationString() const;
97 
98  static bool isDiscoveryIq(const QDomElement &element);
99 
100 protected:
102  void parseElementFromChild(const QDomElement &element);
103  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
105 
106 private:
107  QStringList m_features;
108  QList<QXmppDiscoveryIq::Identity> m_identities;
109  QList<QXmppDiscoveryIq::Item> m_items;
110  QXmppDataForm m_form;
111  QString m_queryNode;
112  enum QueryType m_queryType;
113 };
114 
115 #endif
The QXmppDataForm class represents a data form as defined by XEP-0004: Data Forms.
Definition: QXmppDataForm.h:40
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:42