QXmpp  Version:0.9.1
QXmppArchiveIq.h
1 /*
2  * Copyright (C) 2008-2014 The QXmpp developers
3  *
4  * Author:
5  * Jeremy LainĂ©
6  *
7  * Source:
8  * https://github.com/qxmpp-project/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 QXMPPARCHIVEIQ_H
25 #define QXMPPARCHIVEIQ_H
26 
27 #include "QXmppIq.h"
28 #include "QXmppResultSet.h"
29 
30 #include <QDateTime>
31 
34 
35 class QXMPP_EXPORT QXmppArchiveMessage
36 {
37 public:
39 
40  QString body() const;
41  void setBody(const QString &body);
42 
43  QDateTime date() const;
44  void setDate(const QDateTime &date);
45 
46  bool isReceived() const;
47  void setReceived(bool isReceived);
48 
49 private:
50  QString m_body;
51  QDateTime m_date;
52  bool m_received;
53 };
54 
57 
58 class QXMPP_EXPORT QXmppArchiveChat
59 {
60 public:
62 
63  QList<QXmppArchiveMessage> messages() const;
64  void setMessages(const QList<QXmppArchiveMessage> &messages);
65 
66  QDateTime start() const;
67  void setStart(const QDateTime &start);
68 
69  QString subject() const;
70  void setSubject(const QString &subject);
71 
72  QString thread() const;
73  void setThread(const QString &thread);
74 
75  int version() const;
76  void setVersion(int version);
77 
78  QString with() const;
79  void setWith(const QString &with);
80 
82  void parse(const QDomElement &element);
83  void toXml(QXmlStreamWriter *writer, const QXmppResultSetReply &rsm = QXmppResultSetReply()) const;
85 
86 private:
87  QList<QXmppArchiveMessage> m_messages;
88  QDateTime m_start;
89  QString m_subject;
90  QString m_thread;
91  int m_version;
92  QString m_with;
93 };
94 
100 
101 class QXMPP_EXPORT QXmppArchiveChatIq : public QXmppIq
102 {
103 public:
104  QXmppArchiveChat chat() const;
105  void setChat(const QXmppArchiveChat &chat);
106 
107  QXmppResultSetReply resultSetReply() const;
108  void setResultSetReply(const QXmppResultSetReply &rsm);
109 
111  static bool isArchiveChatIq(const QDomElement &element);
112 
113 protected:
114  void parseElementFromChild(const QDomElement &element);
115  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
117 
118 private:
119  QXmppArchiveChat m_chat;
120  QXmppResultSetReply m_rsmReply;
121 };
122 
126 
127 class QXMPP_EXPORT QXmppArchiveListIq : public QXmppIq
128 {
129 public:
131 
132  QList<QXmppArchiveChat> chats() const;
133  void setChats(const QList<QXmppArchiveChat> &chats);
134 
135  QString with() const;
136  void setWith( const QString &with );
137 
138  QDateTime start() const;
139  void setStart(const QDateTime &start );
140 
141  QDateTime end() const;
142  void setEnd(const QDateTime &end );
143 
144  QXmppResultSetQuery resultSetQuery() const;
145  void setResultSetQuery(const QXmppResultSetQuery &rsm);
146 
147  QXmppResultSetReply resultSetReply() const;
148  void setResultSetReply(const QXmppResultSetReply &rsm);
149 
151  static bool isArchiveListIq(const QDomElement &element);
153 
154 protected:
156  void parseElementFromChild(const QDomElement &element);
157  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
159 
160 private:
161  QString m_with;
162  QDateTime m_start;
163  QDateTime m_end;
164  QList<QXmppArchiveChat> m_chats;
165  QXmppResultSetQuery m_rsmQuery;
166  QXmppResultSetReply m_rsmReply;
167 };
168 
172 
173 class QXMPP_EXPORT QXmppArchiveRemoveIq : public QXmppIq
174 {
175 public:
176  QString with() const;
177  void setWith( const QString &with );
178 
179  QDateTime start() const;
180  void setStart(const QDateTime &start );
181 
182  QDateTime end() const;
183  void setEnd(const QDateTime &end );
184 
186  static bool isArchiveRemoveIq(const QDomElement &element);
187 
188 protected:
189  void parseElementFromChild(const QDomElement &element);
190  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
192 
193 private:
194  QString m_with;
195  QDateTime m_start;
196  QDateTime m_end;
197 };
198 
202 
203 class QXMPP_EXPORT QXmppArchiveRetrieveIq : public QXmppIq
204 {
205 public:
207 
208  QDateTime start() const;
209  void setStart(const QDateTime &start);
210 
211  QString with() const;
212  void setWith(const QString &with);
213 
214  QXmppResultSetQuery resultSetQuery() const;
215  void setResultSetQuery(const QXmppResultSetQuery &rsm);
216 
218  static bool isArchiveRetrieveIq(const QDomElement &element);
219 
220 protected:
221  void parseElementFromChild(const QDomElement &element);
222  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
224 
225 private:
226  QString m_with;
227  QDateTime m_start;
228  QXmppResultSetQuery m_rsmQuery;
229 };
230 
234 
235 class QXMPP_EXPORT QXmppArchivePrefIq : public QXmppIq
236 {
237 public:
239  static bool isArchivePrefIq(const QDomElement &element);
240 
241 protected:
242  void parseElementFromChild(const QDomElement &element);
243  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
245 };
246 
247 #endif // QXMPPARCHIVEIQ_H
Represents an archive remove IQ as defined by XEP-0136: Message Archiving.
Definition: QXmppArchiveIq.h:173
The QXmppArchiveMessage class represents an archived message as defined by XEP-0136: Message Archivin...
Definition: QXmppArchiveIq.h:35
The QXmppResultSetQuery class represents a set element in a query as defined by XEP-0059: Result Set ...
Definition: QXmppResultSet.h:34
Represents an archive list as defined by XEP-0136: Message Archiving.
Definition: QXmppArchiveIq.h:127
Represents an archive chat as defined by XEP-0136: Message Archiving.
Definition: QXmppArchiveIq.h:101
Represents an archive preference IQ as defined by XEP-0136: Message Archiving.
Definition: QXmppArchiveIq.h:235
The QXmppArchiveChat class represents an archived conversation as defined by XEP-0136: Message Archiv...
Definition: QXmppArchiveIq.h:58
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:42
The QXmppResultSetReply class represents a set element in a reply as defined by XEP-0059: Result Set ...
Definition: QXmppResultSet.h:68
Represents an archive retrieve IQ as defined by XEP-0136: Message Archiving.
Definition: QXmppArchiveIq.h:203