QXmpp: QXmppMamManager.h Source File

QXmpp Version: 1.14.3

Loading...
Searching...
No Matches
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
38 class 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
50 QXmppMamManager();
51 ~QXmppMamManager();
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
72 Q_SIGNAL void archivedMessageReceived(const QString &queryId, const QXmppMessage &message);
73
75 Q_SIGNAL void resultsRecieved(const QString &queryId, const QXmppResultSetReply &resultSetReply, bool complete);
76
77private:
78 std::unique_ptr<QXmppMamManagerPrivate> d;
79};
80
81#endif
QXmppClientExtension::discoveryFeatures
virtual QStringList discoveryFeatures() const
Definition QXmppClientExtension.cpp:22
QXmppClientExtension::QXmppClientExtension
QXmppClientExtension()
Definition QXmppClientExtension.cpp:12
QXmppClientExtension::handleStanza
virtual bool handleStanza(const QDomElement &stanza)
You need to implement this method to process incoming XMPP stanzas.
Definition client/compat/removed_api.cpp:44
QXmppMamManager::RetrieveResult
std::variant< RetrievedMessages, QXmppError > RetrieveResult
Definition QXmppMamManager.h:48
QXmppMamManager::archivedMessageReceived
Q_SIGNAL void archivedMessageReceived(const QString &queryId, const QXmppMessage &message)
This signal is emitted when an archived message is received.
QXmppMamManager::retrieveArchivedMessages
QString retrieveArchivedMessages(const QString &to=QString(), const QString &node=QString(), const QString &jid=QString(), const QDateTime &start=QDateTime(), const QDateTime &end=QDateTime(), const QXmppResultSetQuery &resultSetQuery=QXmppResultSetQuery())
Definition QXmppMamManager.cpp:247
QXmppMamManager::resultsRecieved
Q_SIGNAL void resultsRecieved(const QString &queryId, const QXmppResultSetReply &resultSetReply, bool complete)
This signal is emitted when all results for a request have been received.
QXmppMamManager::retrieveMessages
QXmppTask< RetrieveResult > retrieveMessages(const QString &to=QString(), const QString &node=QString(), const QString &jid=QString(), const QDateTime &start=QDateTime(), const QDateTime &end=QDateTime(), const QXmppResultSetQuery &resultSetQuery=QXmppResultSetQuery())
Definition QXmppMamManager.cpp:281
QXmppMessage
The QXmppMessage class represents an XMPP message.
Definition QXmppMessage.h:64
QXmppResultSetQuery
The QXmppResultSetQuery class represents a set element in a query as defined by XEP-0059: Result Set ...
Definition QXmppResultSet.h:18
QXmppResultSetReply
The QXmppResultSetReply class represents a set element in a reply as defined by XEP-0059: Result Set ...
Definition QXmppResultSet.h:53
QXmppTask
Definition QXmppTask.h:46
QXmppMamManager::RetrievedMessages
Contains all retrieved messages and the result IQ that can be used for pagination.
Definition QXmppMamManager.h:43
QXmppMamManager::RetrievedMessages::result
QXmppMamResultIq result
Definition QXmppMamManager.h:44
QXmppMamManager::RetrievedMessages::messages
QVector< QXmppMessage > messages
Definition QXmppMamManager.h:45