QXmppMucIq.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 QXMPPMUCIQ_H
  24. #define QXMPPMUCIQ_H
  25. #include "QXmppDataForm.h"
  26. #include "QXmppIq.h"
  27. /// \brief The QXmppMucItem class represents a chat room "item".
  28. ///
  29. /// It is used to convey information such as permissions.
  30. ///
  31. /// \ingroup Stanzas
  32. class QXMPP_EXPORT QXmppMucItem
  33. {
  34. public:
  35. /// This enum is used to represent long-lived permissions in a room (affiliations).
  36. enum Affiliation {
  37. UnspecifiedAffiliation,
  38. OutcastAffiliation,
  39. NoAffiliation,
  40. MemberAffiliation,
  41. AdminAffiliation,
  42. OwnerAffiliation,
  43. };
  44. /// This enum is used to represent short-lived permissions in a room (roles).
  45. enum Role {
  46. UnspecifiedRole,
  47. NoRole,
  48. VisitorRole,
  49. ParticipantRole,
  50. ModeratorRole,
  51. };
  52. QXmppMucItem();
  53. bool isNull() const;
  54. QString actor() const;
  55. void setActor(const QString &actor);
  56. Affiliation affiliation() const;
  57. void setAffiliation(Affiliation affiliation);
  58. QString jid() const;
  59. void setJid(const QString &jid);
  60. QString nick() const;
  61. void setNick(const QString &nick);
  62. QString reason() const;
  63. void setReason(const QString &reason);
  64. Role role() const;
  65. void setRole(Role role);
  66. /// \cond
  67. void parse(const QDomElement &element);
  68. void toXml(QXmlStreamWriter *writer) const;
  69. static Affiliation affiliationFromString(const QString &affiliationStr);
  70. static QString affiliationToString(Affiliation affiliation);
  71. static Role roleFromString(const QString &roleStr);
  72. static QString roleToString(Role role);
  73. /// \endcond
  74. private:
  75. QString m_actor;
  76. Affiliation m_affiliation;
  77. QString m_jid;
  78. QString m_nick;
  79. QString m_reason;
  80. Role m_role;
  81. };
  82. /// \brief The QXmppMucAdminIq class represents a chat room administration IQ
  83. /// as defined by XEP-0045: Multi-User Chat.
  84. ///
  85. /// It is used to get or modify room memberships.
  86. ///
  87. /// \ingroup Stanzas
  88. class QXMPP_EXPORT QXmppMucAdminIq : public QXmppIq
  89. {
  90. public:
  91. QList<QXmppMucItem> items() const;
  92. void setItems(const QList<QXmppMucItem> &items);
  93. /// \cond
  94. static bool isMucAdminIq(const QDomElement &element);
  95. /// \endcond
  96. protected:
  97. /// \cond
  98. void parseElementFromChild(const QDomElement &element);
  99. void toXmlElementFromChild(QXmlStreamWriter *writer) const;
  100. /// \endcond
  101. private:
  102. QList<QXmppMucItem> m_items;
  103. };
  104. /// \brief The QXmppMucOwnerIq class represents a chat room configuration IQ as
  105. /// defined by XEP-0045: Multi-User Chat.
  106. ///
  107. /// It is used to get or modify room configuration options.
  108. ///
  109. /// \sa QXmppDataForm
  110. ///
  111. class QXMPP_EXPORT QXmppMucOwnerIq : public QXmppIq
  112. {
  113. public:
  114. QXmppDataForm form() const;
  115. void setForm(const QXmppDataForm &form);
  116. /// \cond
  117. static bool isMucOwnerIq(const QDomElement &element);
  118. /// \endcond
  119. protected:
  120. /// \cond
  121. void parseElementFromChild(const QDomElement &element);
  122. void toXmlElementFromChild(QXmlStreamWriter *writer) const;
  123. /// \endcond
  124. private:
  125. QXmppDataForm m_form;
  126. };
  127. #endif