Loading...
Searching...
No Matches
QXmppMamManager.h
// SPDX-FileCopyrightText: 2016 Niels Ole Salscheider <niels_ole@salscheider-online.de>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef QXMPPMAMMANAGER_H
#define QXMPPMAMMANAGER_H
#include "QXmppClientExtension.h"
#include "QXmppError.h"
#include "QXmppMamIq.h"
#include "QXmppResultSet.h"
#include <variant>
#include <QDateTime>
template<typename T>
class QXmppTask;
class QXmppMessage;
class QXmppMamManagerPrivate;
class QXMPP_EXPORT QXmppMamManager : public QXmppClientExtension
{
Q_OBJECT
public:
struct QXMPP_EXPORT RetrievedMessages {
QXmppMamResultIq result;
QVector<QXmppMessage> messages;
};
using RetrieveResult = std::variant<RetrievedMessages, QXmppError>;
QXmppMamManager();
~QXmppMamManager();
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());
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());
QStringList discoveryFeatures() const override;
bool handleStanza(const QDomElement &element) override;
Q_SIGNALS:
void archivedMessageReceived(const QString &queryId,
const QXmppMessage &message);
void resultsRecieved(const QString &queryId,
const QXmppResultSetReply &resultSetReply,
bool complete);
private:
std::unique_ptr<QXmppMamManagerPrivate> d;
};
#endif
QXmppClientExtension
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition QXmppClientExtension.h:32
QXmppClientExtension::discoveryFeatures
virtual QStringList discoveryFeatures() const
Definition QXmppClientExtension.cpp:22
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:26
QXmppMamManager
The QXmppMamManager class makes it possible to access message archives as defined by XEP-0313: Messag...
Definition QXmppMamManager.h:39
QXmppMamManager::resultsRecieved
void resultsRecieved(const QString &queryId, const QXmppResultSetReply &resultSetReply, bool complete)
This signal is emitted when all results for a request have been received.
QXmppMamManager::RetrieveResult
std::variant< RetrievedMessages, QXmppError > RetrieveResult
Definition QXmppMamManager.h:48
QXmppMamManager::archivedMessageReceived
void archivedMessageReceived(const QString &queryId, const QXmppMessage &message)
This signal is emitted when an archived message is received.
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:16
QXmppResultSetReply
The QXmppResultSetReply class represents a set element in a reply as defined by XEP-0059: Result Set ...
Definition QXmppResultSet.h:50
QXmppTask
Definition QXmppTask.h:62
QXmppMamManager::RetrievedMessages
Contains all retrieved messages and the result IQ that can be used for pagination.
Definition QXmppMamManager.h:43
QXmppMamManager::RetrievedMessages::messages
QVector< QXmppMessage > messages
Definition QXmppMamManager.h:45
QXmppMamManager::RetrievedMessages::result
QXmppMamResultIq result
Definition QXmppMamManager.h:44