QXmpp Version: 1.13.0
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 { toXml(writer, {}); }
68 void toXml(QXmlStreamWriter *writer, const QXmppResultSetReply &rsm) const;
70
71private:
72 QList<QXmppArchiveMessage> m_messages;
73 QDateTime m_start;
74 QString m_subject;
75 QString m_thread;
76 int m_version;
77 QString m_with;
78};
79
87class QXMPP_EXPORT QXmppArchiveChatIq : public QXmppIq
88{
89public:
90 QXmppArchiveChat chat() const;
91 void setChat(const QXmppArchiveChat &chat);
92
95
97 static constexpr std::tuple PayloadXmlTag = { u"chat", QXmpp::Private::ns_archive };
98 [[deprecated("Use QXmpp::isIqElement()")]]
99 static bool isArchiveChatIq(const QDomElement &element);
100
101protected:
102 void parseElementFromChild(const QDomElement &element) override;
103 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
105
106private:
107 QXmppArchiveChat m_chat;
108 QXmppResultSetReply m_rsmReply;
109};
110
116class QXMPP_EXPORT QXmppArchiveListIq : public QXmppIq
117{
118public:
120
121 QList<QXmppArchiveChat> chats() const;
122 void setChats(const QList<QXmppArchiveChat> &chats);
123
124 QString with() const;
125 void setWith(const QString &with);
126
127 QDateTime start() const;
128 void setStart(const QDateTime &start);
129
130 QDateTime end() const;
131 void setEnd(const QDateTime &end);
132
134 void setResultSetQuery(const QXmppResultSetQuery &rsm);
135
137 void setResultSetReply(const QXmppResultSetReply &rsm);
138
140 static constexpr std::tuple PayloadXmlTag = { u"list", QXmpp::Private::ns_archive };
141 [[deprecated("Use QXmpp::isIqElement()")]]
142 static bool isArchiveListIq(const QDomElement &element);
144
145protected:
147 void parseElementFromChild(const QDomElement &element) override;
148 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
150
151private:
152 QString m_with;
153 QDateTime m_start;
154 QDateTime m_end;
155 QList<QXmppArchiveChat> m_chats;
156 QXmppResultSetQuery m_rsmQuery;
157 QXmppResultSetReply m_rsmReply;
158};
159
165class QXMPP_EXPORT QXmppArchiveRemoveIq : public QXmppIq
166{
167public:
168 QString with() const;
169 void setWith(const QString &with);
170
171 QDateTime start() const;
172 void setStart(const QDateTime &start);
173
174 QDateTime end() const;
175 void setEnd(const QDateTime &end);
176
178 static constexpr std::tuple PayloadXmlTag = { u"remove", QXmpp::Private::ns_archive };
179 [[deprecated("Use QXmpp::isIqElement()")]]
180 static bool isArchiveRemoveIq(const QDomElement &element);
181
182protected:
183 void parseElementFromChild(const QDomElement &element) override;
184 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
186
187private:
188 QString m_with;
189 QDateTime m_start;
190 QDateTime m_end;
191};
192
198class QXMPP_EXPORT QXmppArchiveRetrieveIq : public QXmppIq
199{
200public:
201 QXmppArchiveRetrieveIq();
202
203 QDateTime start() const;
204 void setStart(const QDateTime &start);
205
206 QString with() const;
207 void setWith(const QString &with);
208
210 void setResultSetQuery(const QXmppResultSetQuery &rsm);
211
213 static constexpr std::tuple PayloadXmlTag = { u"retrieve", QXmpp::Private::ns_archive };
214 [[deprecated("Use QXmpp::isIqElement()")]]
215 static bool isArchiveRetrieveIq(const QDomElement &element);
216
217protected:
218 void parseElementFromChild(const QDomElement &element) override;
219 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
221
222private:
223 QString m_with;
224 QDateTime m_start;
225 QXmppResultSetQuery m_rsmQuery;
226};
227
233class QXMPP_EXPORT QXmppArchivePrefIq : public QXmppIq
234{
235public:
237 static constexpr std::tuple PayloadXmlTag = { u"pref", QXmpp::Private::ns_archive };
238 [[deprecated("Use QXmpp::isIqElement()")]]
239 static bool isArchivePrefIq(const QDomElement &element);
240
241protected:
242 void parseElementFromChild(const QDomElement &element) override;
243 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
245};
246
247#endif // QXMPPARCHIVEIQ_H
Represents an archive chat as defined by XEP-0136: Message Archiving.
Definition QXmppArchiveIq.h:88
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:234
Represents an archive remove IQ as defined by XEP-0136: Message Archiving.
Definition QXmppArchiveIq.h:166
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