QXmppMamManager Class

The QXmppMamManager class makes it possible to access message archives as defined by XEP-0313: Message Archive Management. More...

Header: #include <QXmppMamManager.h>
Since: QXmpp 1.0
Inherits: QXmppClientExtension

Public Types

(since QXmpp 1.5) struct RetrievedMessages
(since QXmpp 1.5) RetrieveResult

Public Functions

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())
(since QXmpp 1.5) QXmppTask<QXmppMamManager::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())
(since QXmpp 1.17) QXmppDiscoFeatureWatch watchAccountSupport() const

Signals

void archivedMessageReceived(const QString &queryId, const QXmppMessage &message)
void resultsRecieved(const QString &queryId, const QXmppResultSetReply &resultSetReply, bool complete)

Detailed Description

To make use of this manager, you need to instantiate it and load it into the QXmppClient instance as follows:

QXmppMamManager *manager = new QXmppMamManager;
client->addExtension(manager);

Checking whether the account supports message archiving using watchAccountSupport() requires the QXmppDiscoveryManager to be registered with the client.

Member Type Documentation

[alias, since QXmpp 1.5] QXmppMamManager::RetrieveResult

Contains RetrievedMessages or an QXmppError.

This typedef was introduced in QXmpp 1.5.

Member Function Documentation

[signal] void QXmppMamManager::archivedMessageReceived(const QString &queryId, const QXmppMessage &message)

This signal is emitted when an archived message is received

queryId.

[signal] void QXmppMamManager::resultsRecieved(const QString &queryId, const QXmppResultSetReply &resultSetReply, bool complete)

This signal is emitted when all results for a request have been received

complete, queryId, and resultSetReply.

QString QXmppMamManager::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())

Retrieves archived messages. For each received message, the archiveMessageReceived() signal is emitted. Once all messages are received, the resultsRecieved() signal is emitted. It returns a result set that can be used to page through the results. The number of results may be limited by the server.

Warning: This API does not work with end-to-end encrypted messages. You can use the new QFuture-based API (retrieveMessages()) for that.

to is an optional entity that should be queried. Leave this empty to query the local archive. node is an optional node that should be queried. This is used when querying a pubsub node. jid is an optional JID to filter the results. start is an optional start time to filter the results, end an optional end time to filter the results. resultSetQuery is an optional Result Set Management query. This can be used to limit the number of results and to page through the archive.

Returns the query id of the request. This can be used to associate the corresponding resultsRecieved signal.

[since QXmpp 1.5] QXmppTask<QXmppMamManager::RetrieveResult> QXmppMamManager::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())

Retrieves archived messages and reports all messages at once via a QFuture.

This function tries to decrypt encrypted messages.

The number of results may be limited by the server.

to is an optional entity that should be queried. Leave this empty to query the local archive. node is an optional node that should be queried. This is used when querying a pubsub node. jid is an optional JID to filter the results. start is an optional start time to filter the results, end an optional end time to filter the results. resultSetQuery is an optional Result Set Management query. This can be used to limit the number of results and to page through the archive.

Returns the result of the query.

This function was introduced in QXmpp 1.5.

[since QXmpp 1.17] QXmppDiscoFeatureWatch QXmppMamManager::watchAccountSupport() const

Returns a watch on whether the own account supports XEP-0313: Message Archive Management.

The information is requested as long as a copy of the watch exists and shared with all other watches on the account information. This requires the QXmppDiscoveryManager to be registered with the client. If the manager is not registered with a client, a watch that never loads is returned.

This function was introduced in QXmpp 1.17.