QXmppDiscoveryIq.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Copyright (C) 2008-2012 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. #ifndef QXMPPDISCOVERY_H
  24. #define QXMPPDISCOVERY_H
  25. #include "QXmppDataForm.h"
  26. #include "QXmppIq.h"
  27. class QXMPP_EXPORT QXmppDiscoveryIq : public QXmppIq
  28. {
  29. public:
  30. class QXMPP_EXPORT Identity
  31. {
  32. public:
  33. QString category() const;
  34. void setCategory(const QString &category);
  35. QString language() const;
  36. void setLanguage(const QString &language);
  37. QString name() const;
  38. void setName(const QString &name);
  39. QString type() const;
  40. void setType(const QString &type);
  41. private:
  42. QString m_category;
  43. QString m_language;
  44. QString m_name;
  45. QString m_type;
  46. };
  47. class QXMPP_EXPORT Item
  48. {
  49. public:
  50. QString jid() const;
  51. void setJid(const QString &jid);
  52. QString name() const;
  53. void setName(const QString &name);
  54. QString node() const;
  55. void setNode(const QString &node);
  56. private:
  57. QString m_jid;
  58. QString m_name;
  59. QString m_node;
  60. };
  61. enum QueryType {
  62. InfoQuery,
  63. ItemsQuery,
  64. };
  65. QStringList features() const;
  66. void setFeatures(const QStringList &features);
  67. QList<QXmppDiscoveryIq::Identity> identities() const;
  68. void setIdentities(const QList<QXmppDiscoveryIq::Identity> &identities);
  69. QList<QXmppDiscoveryIq::Item> items() const;
  70. void setItems(const QList<QXmppDiscoveryIq::Item> &items);
  71. QXmppDataForm form() const;
  72. void setForm(const QXmppDataForm &form);
  73. QString queryNode() const;
  74. void setQueryNode(const QString &node);
  75. enum QueryType queryType() const;
  76. void setQueryType(enum QueryType type);
  77. QByteArray verificationString() const;
  78. static bool isDiscoveryIq(const QDomElement &element);
  79. protected:
  80. /// \cond
  81. void parseElementFromChild(const QDomElement &element);
  82. void toXmlElementFromChild(QXmlStreamWriter *writer) const;
  83. /// \endcond
  84. private:
  85. QStringList m_features;
  86. QList<QXmppDiscoveryIq::Identity> m_identities;
  87. QList<QXmppDiscoveryIq::Item> m_items;
  88. QXmppDataForm m_form;
  89. QString m_queryNode;
  90. enum QueryType m_queryType;
  91. };
  92. #endif