QXmpp Version: 1.5.6
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
38class QXMPP_EXPORT QXmppMamManager : public QXmppClientExtension
39{
40 Q_OBJECT
41
42public:
43 struct QXMPP_EXPORT RetrievedMessages
44 {
45 QXmppMamResultIq result;
46 QVector<QXmppMessage> messages;
47 };
48
49 using RetrieveResult = std::variant<RetrievedMessages, QXmppError>;
50
53
54 QString retrieveArchivedMessages(const QString &to = QString(),
55 const QString &node = QString(),
56 const QString &jid = QString(),
57 const QDateTime &start = QDateTime(),
58 const QDateTime &end = QDateTime(),
59 const QXmppResultSetQuery &resultSetQuery = QXmppResultSetQuery());
60 QXmppTask<RetrieveResult> retrieveMessages(const QString &to = QString(),
61 const QString &node = QString(),
62 const QString &jid = QString(),
63 const QDateTime &start = QDateTime(),
64 const QDateTime &end = QDateTime(),
65 const QXmppResultSetQuery &resultSetQuery = QXmppResultSetQuery());
66
68 QStringList discoveryFeatures() const override;
69 bool handleStanza(const QDomElement &element) override;
71
72Q_SIGNALS:
74 void archivedMessageReceived(const QString &queryId,
75 const QXmppMessage &message);
76
78 void resultsRecieved(const QString &queryId,
79 const QXmppResultSetReply &resultSetReply,
80 bool complete);
81
82private:
83 std::unique_ptr<QXmppMamManagerPrivate> d;
84};
85
86#endif
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition QXmppClientExtension.h:33
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 QXmppClientExtension.cpp:51
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:49
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:35
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:44
QVector< QXmppMessage > messages
Definition QXmppMamManager.h:46
QXmppMamResultIq result
Definition QXmppMamManager.h:45