QXmppArchiveIq.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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 QXMPPARCHIVEIQ_H
  24. #define QXMPPARCHIVEIQ_H
  25. #include "QXmppIq.h"
  26. #include "QXmppResultSet.h"
  27. #include <QDateTime>
  28. /// \brief The QXmppArchiveMessage class represents an archived message
  29. /// as defined by XEP-0136: Message Archiving.
  30. class QXMPP_EXPORT QXmppArchiveMessage
  31. {
  32. public:
  33. QXmppArchiveMessage();
  34. QString body() const;
  35. void setBody(const QString &body);
  36. QDateTime date() const;
  37. void setDate(const QDateTime &date);
  38. bool isReceived() const;
  39. void setReceived(bool isReceived);
  40. private:
  41. QString m_body;
  42. QDateTime m_date;
  43. bool m_received;
  44. };
  45. /// \brief The QXmppArchiveChat class represents an archived conversation
  46. /// as defined by XEP-0136: Message Archiving.
  47. class QXMPP_EXPORT QXmppArchiveChat
  48. {
  49. public:
  50. QXmppArchiveChat();
  51. QList<QXmppArchiveMessage> messages() const;
  52. void setMessages(const QList<QXmppArchiveMessage> &messages);
  53. QDateTime start() const;
  54. void setStart(const QDateTime &start);
  55. QString subject() const;
  56. void setSubject(const QString &subject);
  57. QString thread() const;
  58. void setThread(const QString &thread);
  59. int version() const;
  60. void setVersion(int version);
  61. QString with() const;
  62. void setWith(const QString &with);
  63. /// \cond
  64. void parse(const QDomElement &element);
  65. void toXml(QXmlStreamWriter *writer, const QXmppResultSetReply &rsm = QXmppResultSetReply()) const;
  66. /// \endcond
  67. private:
  68. QList<QXmppArchiveMessage> m_messages;
  69. QDateTime m_start;
  70. QString m_subject;
  71. QString m_thread;
  72. int m_version;
  73. QString m_with;
  74. };
  75. /// \brief Represents an archive chat as defined by XEP-0136: Message Archiving.
  76. ///
  77. /// It is used to get chat as a QXmppArchiveChat.
  78. ///
  79. /// \ingroup Stanzas
  80. class QXMPP_EXPORT QXmppArchiveChatIq : public QXmppIq
  81. {
  82. public:
  83. QXmppArchiveChat chat() const;
  84. void setChat(const QXmppArchiveChat &chat);
  85. QXmppResultSetReply resultSetReply() const;
  86. void setResultSetReply(const QXmppResultSetReply &rsm);
  87. /// \cond
  88. static bool isArchiveChatIq(const QDomElement &element);
  89. protected:
  90. void parseElementFromChild(const QDomElement &element);
  91. void toXmlElementFromChild(QXmlStreamWriter *writer) const;
  92. /// \endcond
  93. private:
  94. QXmppArchiveChat m_chat;
  95. QXmppResultSetReply m_rsmReply;
  96. };
  97. /// \brief Represents an archive list as defined by XEP-0136: Message Archiving.
  98. ///
  99. /// \ingroup Stanzas
  100. class QXMPP_EXPORT QXmppArchiveListIq : public QXmppIq
  101. {
  102. public:
  103. QXmppArchiveListIq();
  104. QList<QXmppArchiveChat> chats() const;
  105. void setChats(const QList<QXmppArchiveChat> &chats);
  106. QString with() const;
  107. void setWith( const QString &with );
  108. QDateTime start() const;
  109. void setStart(const QDateTime &start );
  110. QDateTime end() const;
  111. void setEnd(const QDateTime &end );
  112. QXmppResultSetQuery resultSetQuery() const;
  113. void setResultSetQuery(const QXmppResultSetQuery &rsm);
  114. QXmppResultSetReply resultSetReply() const;
  115. void setResultSetReply(const QXmppResultSetReply &rsm);
  116. /// \cond
  117. static bool isArchiveListIq(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. QString m_with;
  126. QDateTime m_start;
  127. QDateTime m_end;
  128. QList<QXmppArchiveChat> m_chats;
  129. QXmppResultSetQuery m_rsmQuery;
  130. QXmppResultSetReply m_rsmReply;
  131. };
  132. /// \brief Represents an archive remove IQ as defined by XEP-0136: Message Archiving.
  133. ///
  134. /// \ingroup Stanzas
  135. class QXMPP_EXPORT QXmppArchiveRemoveIq : public QXmppIq
  136. {
  137. public:
  138. QString with() const;
  139. void setWith( const QString &with );
  140. QDateTime start() const;
  141. void setStart(const QDateTime &start );
  142. QDateTime end() const;
  143. void setEnd(const QDateTime &end );
  144. /// \cond
  145. static bool isArchiveRemoveIq(const QDomElement &element);
  146. protected:
  147. void parseElementFromChild(const QDomElement &element);
  148. void toXmlElementFromChild(QXmlStreamWriter *writer) const;
  149. /// \endcond
  150. private:
  151. QString m_with;
  152. QDateTime m_start;
  153. QDateTime m_end;
  154. };
  155. /// \brief Represents an archive retrieve IQ as defined by XEP-0136: Message Archiving.
  156. ///
  157. /// \ingroup Stanzas
  158. class QXMPP_EXPORT QXmppArchiveRetrieveIq : public QXmppIq
  159. {
  160. public:
  161. QXmppArchiveRetrieveIq();
  162. QDateTime start() const;
  163. void setStart(const QDateTime &start);
  164. QString with() const;
  165. void setWith(const QString &with);
  166. QXmppResultSetQuery resultSetQuery() const;
  167. void setResultSetQuery(const QXmppResultSetQuery &rsm);
  168. /// \cond
  169. static bool isArchiveRetrieveIq(const QDomElement &element);
  170. protected:
  171. void parseElementFromChild(const QDomElement &element);
  172. void toXmlElementFromChild(QXmlStreamWriter *writer) const;
  173. /// \endcond
  174. private:
  175. QString m_with;
  176. QDateTime m_start;
  177. QXmppResultSetQuery m_rsmQuery;
  178. };
  179. /// \brief Represents an archive preference IQ as defined by XEP-0136: Message Archiving.
  180. ///
  181. /// \ingroup Stanzas
  182. class QXMPP_EXPORT QXmppArchivePrefIq : public QXmppIq
  183. {
  184. public:
  185. /// \cond
  186. static bool isArchivePrefIq(const QDomElement &element);
  187. protected:
  188. void parseElementFromChild(const QDomElement &element);
  189. void toXmlElementFromChild(QXmlStreamWriter *writer) const;
  190. /// \endcond
  191. };
  192. #endif // QXMPPARCHIVEIQ_H