QXmpp  Version:0.4.91
 All Classes Functions Enumerations Enumerator Properties Groups
QXmppDiscoveryIq.h
1 /*
2  * Copyright (C) 2008-2011 The QXmpp developers
3  *
4  * Author:
5  * Jeremy LainĂ©
6  *
7  * Source:
8  * http://code.google.com/p/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 QDomElement;
31 
32 class QXMPP_EXPORT QXmppDiscoveryIq : public QXmppIq
33 {
34 public:
35  class QXMPP_EXPORT Identity
36  {
37  public:
38  QString category() const;
39  void setCategory(const QString &category);
40 
41  QString language() const;
42  void setLanguage(const QString &language);
43 
44  QString name() const;
45  void setName(const QString &name);
46 
47  QString type() const;
48  void setType(const QString &type);
49 
50  private:
51  QString m_category;
52  QString m_language;
53  QString m_name;
54  QString m_type;
55  };
56 
57  class QXMPP_EXPORT Item
58  {
59  public:
60  QString jid() const;
61  void setJid(const QString &jid);
62 
63  QString name() const;
64  void setName(const QString &name);
65 
66  QString node() const;
67  void setNode(const QString &node);
68 
69  private:
70  QString m_jid;
71  QString m_name;
72  QString m_node;
73  };
74 
75  enum QueryType {
76  InfoQuery,
77  ItemsQuery,
78  };
79 
80  QStringList features() const;
81  void setFeatures(const QStringList &features);
82 
83  QList<QXmppDiscoveryIq::Identity> identities() const;
84  void setIdentities(const QList<QXmppDiscoveryIq::Identity> &identities);
85 
86  QList<QXmppDiscoveryIq::Item> items() const;
87  void setItems(const QList<QXmppDiscoveryIq::Item> &items);
88 
89  QXmppDataForm form() const;
90  void setForm(const QXmppDataForm &form);
91 
92  QString queryNode() const;
93  void setQueryNode(const QString &node);
94 
95  enum QueryType queryType() const;
96  void setQueryType(enum QueryType type);
97 
98  QByteArray verificationString() const;
99 
100  static bool isDiscoveryIq(const QDomElement &element);
101 
102 protected:
104  void parseElementFromChild(const QDomElement &element);
105  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
107 
108 private:
109  QStringList m_features;
110  QList<QXmppDiscoveryIq::Identity> m_identities;
111  QList<QXmppDiscoveryIq::Item> m_items;
112  QXmppDataForm m_form;
113  QString m_queryNode;
114  enum QueryType m_queryType;
115 };
116 
117 #endif