QXmppRpcIq.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Copyright (C) 2008-2012 The QXmpp developers
  3. *
  4. * Authors:
  5. * Ian Reinhart Geiser
  6. * Jeremy Lainé
  7. *
  8. * Source:
  9. * http://code.google.com/p/qxmpp
  10. *
  11. * This file is a part of QXmpp library.
  12. *
  13. * This library is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU Lesser General Public
  15. * License as published by the Free Software Foundation; either
  16. * version 2.1 of the License, or (at your option) any later version.
  17. *
  18. * This library is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  21. * Lesser General Public License for more details.
  22. *
  23. */
  24. #ifndef QXMPPRPCIQ_H
  25. #define QXMPPRPCIQ_H
  26. #include "QXmppIq.h"
  27. #include <QVariant>
  28. class QXMPP_EXPORT QXmppRpcMarshaller
  29. {
  30. public:
  31. static void marshall( QXmlStreamWriter *writer, const QVariant &value);
  32. static QVariant demarshall(const QDomElement &elem, QStringList &errors);
  33. };
  34. /// \brief The QXmppRpcResponseIq class represents an IQ used to carry
  35. /// an RPC response as specified by XEP-0009: Jabber-RPC.
  36. ///
  37. /// \ingroup Stanzas
  38. class QXMPP_EXPORT QXmppRpcResponseIq : public QXmppIq
  39. {
  40. public:
  41. QXmppRpcResponseIq();
  42. int faultCode() const;
  43. void setFaultCode(int faultCode);
  44. QString faultString() const;
  45. void setFaultString(const QString &faultString);
  46. QVariantList values() const;
  47. void setValues(const QVariantList &values);
  48. /// \cond
  49. static bool isRpcResponseIq(const QDomElement &element);
  50. /// \endcond
  51. protected:
  52. /// \cond
  53. void parseElementFromChild(const QDomElement &element);
  54. void toXmlElementFromChild(QXmlStreamWriter *writer) const;
  55. /// \endcond
  56. private:
  57. int m_faultCode;
  58. QString m_faultString;
  59. QVariantList m_values;
  60. };
  61. /// \brief The QXmppRpcInvokeIq class represents an IQ used to carry
  62. /// an RPC invocation as specified by XEP-0009: Jabber-RPC.
  63. ///
  64. /// \ingroup Stanzas
  65. class QXMPP_EXPORT QXmppRpcInvokeIq : public QXmppIq
  66. {
  67. public:
  68. QXmppRpcInvokeIq();
  69. QString method() const;
  70. void setMethod( const QString &method );
  71. QVariantList arguments() const;
  72. void setArguments(const QVariantList &arguments);
  73. /// \cond
  74. static bool isRpcInvokeIq(const QDomElement &element);
  75. /// \endcond
  76. protected:
  77. /// \cond
  78. void parseElementFromChild(const QDomElement &element);
  79. void toXmlElementFromChild(QXmlStreamWriter *writer) const;
  80. /// \endcond
  81. private:
  82. QVariantList m_arguments;
  83. QString m_method;
  84. friend class QXmppRpcErrorIq;
  85. };
  86. class QXMPP_EXPORT QXmppRpcErrorIq : public QXmppIq
  87. {
  88. public:
  89. QXmppRpcErrorIq();
  90. QXmppRpcInvokeIq query() const;
  91. void setQuery(const QXmppRpcInvokeIq &query);
  92. /// \cond
  93. static bool isRpcErrorIq(const QDomElement &element);
  94. /// \endcond
  95. protected:
  96. /// \cond
  97. void parseElementFromChild(const QDomElement &element);
  98. void toXmlElementFromChild(QXmlStreamWriter *writer) const;
  99. /// \endcond
  100. private:
  101. QXmppRpcInvokeIq m_query;
  102. };
  103. #endif // QXMPPRPCIQ_H