QXmpp Version: 1.11.2
Loading...
Searching...
No Matches
QXmppArchiveIq.h
1// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPARCHIVEIQ_H
6#define QXMPPARCHIVEIQ_H
7
8#include "QXmppIq.h"
9#include "QXmppResultSet.h"
10
11#include <QDateTime>
12
17class QXMPP_EXPORT QXmppArchiveMessage
18{
19public:
20 QXmppArchiveMessage();
21
22 QString body() const;
23 void setBody(const QString &body);
24
25 QDateTime date() const;
26 void setDate(const QDateTime &date);
27
28 bool isReceived() const;
29 void setReceived(bool isReceived);
30
31private:
32 QString m_body;
33 QDateTime m_date;
34 bool m_received;
35};
36
41class QXMPP_EXPORT QXmppArchiveChat
42{
43public:
44 QXmppArchiveChat();
45
46 QList<QXmppArchiveMessage> messages() const;
47 void setMessages(const QList<QXmppArchiveMessage> &messages);
48
49 QDateTime start() const;
50 void setStart(const QDateTime &start);
51
52 QString subject() const;
53 void setSubject(const QString &subject);
54
55 QString thread() const;
56 void setThread(const QString &thread);
57
58 int version() const;
59 void setVersion(int version);
60
61 QString with() const;
62 void setWith(const QString &with);
63
65 static constexpr std::tuple XmlTag = { u"chat", QXmpp::Private::ns_archive };
66 void parse(const QDomElement &element);
67 void toXml(QXmlStreamWriter *writer, const QXmppResultSetReply &rsm = QXmppResultSetReply()) const;
69
70private:
71 QList<QXmppArchiveMessage> m_messages;
72 QDateTime m_start;
73 QString m_subject;
74 QString m_thread;
75 int m_version;
76 QString m_with;
77};
78
86class QXMPP_EXPORT QXmppArchiveChatIq : public QXmppIq
87{
88public:
89 QXmppArchiveChat chat() const;
90 void setChat(const QXmppArchiveChat &chat);
91
94
96 static constexpr std::tuple PayloadXmlTag = { u"chat", QXmpp::Private::ns_archive };
97 [[deprecated("Use QXmpp::isIqElement()")]]
98 static bool isArchiveChatIq(const QDomElement &element);
99
100protected:
101 void parseElementFromChild(const QDomElement &element) override;
102 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
104
105private:
106 QXmppArchiveChat m_chat;
107 QXmppResultSetReply m_rsmReply;
108};
109
115class QXMPP_EXPORT QXmppArchiveListIq : public QXmppIq
116{
117public:
119
120 QList<QXmppArchiveChat> chats() const;
121 void setChats(const QList<QXmppArchiveChat> &chats);
122
123 QString with() const;
124 void setWith(const QString &with);
125
126 QDateTime start() const;
127 void setStart(const QDateTime &start);
128
129 QDateTime end() const;
130 void setEnd(const QDateTime &end);
131
133 void setResultSetQuery(const QXmppResultSetQuery &rsm);
134
136 void setResultSetReply(const QXmppResultSetReply &rsm);
137
139 static constexpr std::tuple PayloadXmlTag = { u"list", QXmpp::Private::ns_archive };
140 [[deprecated("Use QXmpp::isIqElement()")]]
141 static bool isArchiveListIq(const QDomElement &element);
143
144protected:
146 void parseElementFromChild(const QDomElement &element) override;
147 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
149
150private:
151 QString m_with;
152 QDateTime m_start;
153 QDateTime m_end;
154 QList<QXmppArchiveChat> m_chats;
155 QXmppResultSetQuery m_rsmQuery;
156 QXmppResultSetReply m_rsmReply;
157};
158
164class QXMPP_EXPORT QXmppArchiveRemoveIq : public QXmppIq
165{
166public:
167 QString with() const;
168 void setWith(const QString &with);
169
170 QDateTime start() const;
171 void setStart(const QDateTime &start);
172
173 QDateTime end() const;
174 void setEnd(const QDateTime &end);
175
177 static constexpr std::tuple PayloadXmlTag = { u"remove", QXmpp::Private::ns_archive };
178 [[deprecated("Use QXmpp::isIqElement()")]]
179 static bool isArchiveRemoveIq(const QDomElement &element);
180
181protected:
182 void parseElementFromChild(const QDomElement &element) override;
183 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
185
186private:
187 QString m_with;
188 QDateTime m_start;
189 QDateTime m_end;
190};
191
197class QXMPP_EXPORT QXmppArchiveRetrieveIq : public QXmppIq
198{
199public:
200 QXmppArchiveRetrieveIq();
201
202 QDateTime start() const;
203 void setStart(const QDateTime &start);
204
205 QString with() const;
206 void setWith(const QString &with);
207
209 void setResultSetQuery(const QXmppResultSetQuery &rsm);
210
212 static constexpr std::tuple PayloadXmlTag = { u"retrieve", QXmpp::Private::ns_archive };
213 [[deprecated("Use QXmpp::isIqElement()")]]
214 static bool isArchiveRetrieveIq(const QDomElement &element);
215
216protected:
217 void parseElementFromChild(const QDomElement &element) override;
218 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
220
221private:
222 QString m_with;
223 QDateTime m_start;
224 QXmppResultSetQuery m_rsmQuery;
225};
226
232class QXMPP_EXPORT QXmppArchivePrefIq : public QXmppIq
233{
234public:
236 static constexpr std::tuple PayloadXmlTag = { u"pref", QXmpp::Private::ns_archive };
237 [[deprecated("Use QXmpp::isIqElement()")]]
238 static bool isArchivePrefIq(const QDomElement &element);
239
240protected:
241 void parseElementFromChild(const QDomElement &element) override;
242 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
244};
245
246#endif // QXMPPARCHIVEIQ_H
Represents an archive chat as defined by XEP-0136: Message Archiving.
Definition QXmppArchiveIq.h:87
QXmppResultSetReply resultSetReply() const
Definition QXmppArchiveIq.cpp:204
void setResultSetReply(const QXmppResultSetReply &rsm)
Definition QXmppArchiveIq.cpp:214
QXmppArchiveChat chat() const
Returns the chat conversation carried by this IQ.
Definition QXmppArchiveIq.cpp:188
void setChat(const QXmppArchiveChat &chat)
Sets the chat conversation carried by this IQ.
Definition QXmppArchiveIq.cpp:194
The QXmppArchiveChat class represents an archived conversation as defined by XEP-0136: Message Archiv...
Definition QXmppArchiveIq.h:42
void setVersion(int version)
Sets the conversation's version.
Definition QXmppArchiveIq.cpp:170
int version() const
Returns the conversation's version.
Definition QXmppArchiveIq.cpp:164
QString subject() const
Returns the conversation's subject.
Definition QXmppArchiveIq.cpp:140
QString thread() const
Returns the conversation's thread.
Definition QXmppArchiveIq.cpp:152
void setThread(const QString &thread)
Sets the conversation's thread.
Definition QXmppArchiveIq.cpp:158
void setStart(const QDateTime &start)
Sets the start of this conversation.
Definition QXmppArchiveIq.cpp:134
QList< QXmppArchiveMessage > messages() const
Returns the conversation's messages.
Definition QXmppArchiveIq.cpp:116
QDateTime start() const
Returns the start of this conversation.
Definition QXmppArchiveIq.cpp:128
void setWith(const QString &with)
Sets the JID of the remote party.
Definition QXmppArchiveIq.cpp:182
QString with() const
Returns the JID of the remote party.
Definition QXmppArchiveIq.cpp:176
void setSubject(const QString &subject)
Sets the conversation's subject.
Definition QXmppArchiveIq.cpp:146
void setMessages(const QList< QXmppArchiveMessage > &messages)
Sets the conversation's messages.
Definition QXmppArchiveIq.cpp:122
QDateTime end() const
Returns the end date/time for the archived conversations.
Definition QXmppArchiveIq.cpp:276
void setResultSetReply(const QXmppResultSetReply &rsm)
Definition QXmppArchiveIq.cpp:322
QDateTime start() const
Returns the start date/time for the archived conversations.
Definition QXmppArchiveIq.cpp:264
QXmppResultSetQuery resultSetQuery() const
Definition QXmppArchiveIq.cpp:292
QList< QXmppArchiveChat > chats() const
Returns the list of chat conversations.
Definition QXmppArchiveIq.cpp:240
void setStart(const QDateTime &start)
Sets the start date/time for the archived conversations.
Definition QXmppArchiveIq.cpp:270
QXmppResultSetReply resultSetReply() const
Definition QXmppArchiveIq.cpp:312
void setResultSetQuery(const QXmppResultSetQuery &rsm)
Definition QXmppArchiveIq.cpp:302
QXmppArchiveListIq()
Constructs a QXmppArchiveListIq.
Definition QXmppArchiveIq.cpp:234
QString with() const
Returns the JID which archived conversations must match.
Definition QXmppArchiveIq.cpp:252
void setChats(const QList< QXmppArchiveChat > &chats)
Sets the list of chat conversations.
Definition QXmppArchiveIq.cpp:246
void setEnd(const QDateTime &end)
Sets the end date/time for the archived conversations.
Definition QXmppArchiveIq.cpp:282
void setWith(const QString &with)
Sets the JID which archived conversations must match.
Definition QXmppArchiveIq.cpp:258
bool isReceived() const
Returns true if the archived message was received, false if it was sent.
Definition QXmppArchiveIq.cpp:48
void setBody(const QString &body)
Sets the archived message's body.
Definition QXmppArchiveIq.cpp:30
QString body() const
Returns the archived message's body.
Definition QXmppArchiveIq.cpp:24
void setDate(const QDateTime &date)
Sets the archived message's date.
Definition QXmppArchiveIq.cpp:42
void setReceived(bool isReceived)
Set to true if the archived message was received, false if it was sent.
Definition QXmppArchiveIq.cpp:54
QDateTime date() const
Returns the archived message's date.
Definition QXmppArchiveIq.cpp:36
Represents an archive preference IQ as defined by XEP-0136: Message Archiving.
Definition QXmppArchiveIq.h:233
Represents an archive remove IQ as defined by XEP-0136: Message Archiving.
Definition QXmppArchiveIq.h:165
QString with() const
Returns the JID which archived conversations must match.
Definition QXmppArchiveIq.cpp:367
QDateTime start() const
Returns the start date/time for the archived conversations.
Definition QXmppArchiveIq.cpp:379
void setEnd(const QDateTime &end)
Sets the end date/time for the archived conversations.
Definition QXmppArchiveIq.cpp:397
QDateTime end() const
Returns the end date/time for the archived conversations.
Definition QXmppArchiveIq.cpp:391
void setWith(const QString &with)
Sets the JID which archived conversations must match.
Definition QXmppArchiveIq.cpp:373
void setStart(const QDateTime &start)
Sets the start date/time for the archived conversations.
Definition QXmppArchiveIq.cpp:385
void setWith(const QString &with)
Sets the JID which archived conversations must match.
Definition QXmppArchiveIq.cpp:446
QString with() const
Returns the JID which archived conversations must match.
Definition QXmppArchiveIq.cpp:440
QDateTime start() const
Returns the start date/time for the archived conversations.
Definition QXmppArchiveIq.cpp:428
void setStart(const QDateTime &start)
Sets the start date/time for the archived conversations.
Definition QXmppArchiveIq.cpp:434
QXmppResultSetQuery resultSetQuery() const
Definition QXmppArchiveIq.cpp:456
void setResultSetQuery(const QXmppResultSetQuery &rsm)
Definition QXmppArchiveIq.cpp:466
QXmppIq(QXmppIq::Type type=QXmppIq::Get)
Definition QXmppIq.cpp:39
The QXmppResultSetQuery class represents a set element in a query as defined by XEP-0059: Result Set ...
Definition QXmppResultSet.h:18
The QXmppResultSetReply class represents a set element in a reply as defined by XEP-0059: Result Set ...
Definition QXmppResultSet.h:53