QXmppMovedManager Class

Header: #include <QXmppMovedManager>
Since: QXmpp 1.9
Inherits: QXmppClientExtension

Public Types

Properties

Public Functions

QXmppMovedManager()
QXmppTask<QXmpp::SendResult> notifyContact(const QString &contactBareJid, const QString &oldBareJid, bool sensitive = true, const QString &reason = {})
QXmppTask<QXmppMovedManager::Result> publishStatement(QString newBareJid)
bool supportedByServer() const
QXmppTask<QXmppMovedManager::Result> verifyStatement(QString oldBareJid, QString newBareJid)

Signals

Detailed Description

This class manages user account moving as specified in XEP-0283: Moved

In order to use this manager, make sure to add all managers needed by this manager:

 client->addNewExtension<QXmppDiscoveryManager>();
 client->addNewExtension<QXmppPubSubManager>();

Afterwards, you need to add this manager to the client:

 auto *manager = client->addNewExtension<QXmppMovedManager>();

If you want to publish a moved statement use the publishStatement call with the old account:

 manager->publishStatement("new@example.org");

Once you published your statement, you then need to subscribe to your old contacts with the new account:

 manager->notifyContact("contact@xmpp.example", "old@example.org", "Hey, I moved my account, please accept me.");

When a contact receive a subscription request from a moved user he needs to verify the authenticity of the request. The QXmppRosterManager handle it on its own if the client has the QXmppMovedManager extension available. The request will be ignored entirely if the old jid incoming subscription is not part of the roster with a 'from' or 'both' type. In case of the authenticity can't be established the moved element is ignored entirely. Alternatively, if the client does not has QXmppMovedManager support the request message will be changed to introduce a warning message before emitting the subscription{Request}Received signal.

Member Type Documentation

[alias] QXmppMovedManager::Result

Contains QXmpp::Success or an error.

Property Documentation

[read-only] supportedByServer : const bool

Access functions:

bool supportedByServer() const

Notifier signal:

See also QXmppMovedManager::supportedByServer().

Member Function Documentation

[explicit] QXmppMovedManager::QXmppMovedManager()

Constructs a XEP-0283: Moved manager.

QXmppTask<QXmpp::SendResult> QXmppMovedManager::notifyContact(const QString &contactBareJid, const QString &oldBareJid, bool sensitive = true, const QString &reason = {})

Notifies a contact that the user has moved to another account.

contactBareJid is the JID of the contact to send the subscription request. oldBareJid is the JID of the old account we moved from. If sensitive is true the notification is sent sensitively. reason is the reason of the move.

Returns the result of the action.

QXmppTask<QXmppMovedManager::Result> QXmppMovedManager::publishStatement(QString newBareJid)

Publish a moved statement. newBareJid is the JID of the new account.

Returns the result of the action.

bool QXmppMovedManager::supportedByServer() const

Returns whether the own server supports the XEP-0283: Moved feature.

Note: Getter function for property supportedByServer.

[signal] void QXmppMovedManager::supportedByServerChanged()

Emitted when the server enabled or disabled support for XEP-0283: Moved.

Note: Notifier signal for property supportedByServer.

QXmppTask<QXmppMovedManager::Result> QXmppMovedManager::verifyStatement(QString oldBareJid, QString newBareJid)

Verify a user moved statement.

oldBareJid is the JID of the old account to check statement. newBareJid is the JID of the new account that sent the subscription request.

Returns the result of the action.