QXmpp Version: 1.10.0
QXmppMamManager.h
1// SPDX-FileCopyrightText: 2016 Niels Ole Salscheider <niels_ole@salscheider-online.de>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPMAMMANAGER_H
6#define QXMPPMAMMANAGER_H
7
8#include "QXmppClientExtension.h"
9#include "QXmppError.h"
10#include "QXmppMamIq.h"
11#include "QXmppResultSet.h"
12
13#include <variant>
14
15#include <QDateTime>
16
17template<typename T>
18class QXmppTask;
19class QXmppMessage;
20class QXmppMamManagerPrivate;
21
38class QXMPP_EXPORT QXmppMamManager : public QXmppClientExtension
39{
40 Q_OBJECT
41
42public:
43 struct QXMPP_EXPORT RetrievedMessages {
44 QXmppMamResultIq result;
45 QVector<QXmppMessage> messages;
46 };
47
48 using RetrieveResult = std::variant<RetrievedMessages, QXmppError>;
49
52
53 QString retrieveArchivedMessages(const QString &to = QString(),
54 const QString &node = QString(),
55 const QString &jid = QString(),
56 const QDateTime &start = QDateTime(),
57 const QDateTime &end = QDateTime(),
58 const QXmppResultSetQuery &resultSetQuery = QXmppResultSetQuery());
59 QXmppTask<RetrieveResult> retrieveMessages(const QString &to = QString(),
60 const QString &node = QString(),
61 const QString &jid = QString(),
62 const QDateTime &start = QDateTime(),
63 const QDateTime &end = QDateTime(),
64 const QXmppResultSetQuery &resultSetQuery = QXmppResultSetQuery());
65
67 QStringList discoveryFeatures() const override;
68 bool handleStanza(const QDomElement &element) override;
70
71Q_SIGNALS:
73 void archivedMessageReceived(const QString &queryId,
74 const QXmppMessage &message);
75
77 void resultsRecieved(const QString &queryId,
78 const QXmppResultSetReply &resultSetReply,
79 bool complete);
80
81private:
82 std::unique_ptr<QXmppMamManagerPrivate> d;
83};
84
85#endif
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:32
virtual QStringList discoveryFeatures() const
Definition: QXmppClientExtension.cpp:22
virtual bool handleStanza(const QDomElement &stanza)
You need to implement this method to process incoming XMPP stanzas.
Definition: client/compat/removed_api.cpp:26
The QXmppMamManager class makes it possible to access message archives as defined by XEP-0313: Messag...
Definition: QXmppMamManager.h:39
void resultsRecieved(const QString &queryId, const QXmppResultSetReply &resultSetReply, bool complete)
This signal is emitted when all results for a request have been received.
std::variant< RetrievedMessages, QXmppError > RetrieveResult
Definition: QXmppMamManager.h:48
void archivedMessageReceived(const QString &queryId, const QXmppMessage &message)
This signal is emitted when an archived message is received.
The QXmppMessage class represents an XMPP message.
Definition: QXmppMessage.h:64
The QXmppResultSetQuery class represents a set element in a query as defined by XEP-0059: Result Set ...
Definition: QXmppResultSet.h:16
The QXmppResultSetReply class represents a set element in a reply as defined by XEP-0059: Result Set ...
Definition: QXmppResultSet.h:50
Definition: QXmppTask.h:62
Contains all retrieved messages and the result IQ that can be used for pagination.
Definition: QXmppMamManager.h:43
QVector< QXmppMessage > messages
Definition: QXmppMamManager.h:45
QXmppMamResultIq result
Definition: QXmppMamManager.h:44