QXmpp: QXmppMovedManager Class Reference

QXmpp Version: 1.14.4

Loading...
Searching...
No Matches
QXmppMovedManager Class Reference
Managers
Inheritance diagram for QXmppMovedManager:

## Public Types
using | Result = std::variant<QXmpp::Success, QXmppError>

## Public Member Functions
| QXmppMovedManager ()
QStringList | discoveryFeatures () const override
bool | supportedByServer () const
Q_SIGNAL void | supportedByServerChanged ()
QXmppTask< Result > | publishStatement (const QString &newBareJid)
QXmppTask< Result > | verifyStatement (const QString &oldBareJid, const QString &newBareJid)
QXmppTask< QXmpp::SendResult > | notifyContact (const QString &contactBareJid, const QString &oldBareJid, bool sensitive=true, const QString &reason={})
Public Member Functions inherited from QXmppClientExtension
| QXmppClientExtension ()
virtual QList< QXmppDiscoIdentity > | discoveryIdentities () const
virtual bool | handleStanza (const QDomElement &stanza)
| You need to implement this method to process incoming XMPP stanzas.
virtual bool | handleStanza (const QDomElement &stanza, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
| You need to implement this method to process incoming XMPP stanzas.
Public Member Functions inherited from QXmppLoggable
| QXmppLoggable (QObject *parent=nullptr)
Q_SIGNAL void | setGauge (const QString &gauge, double value)
| Sets the given gauge to value.
Q_SIGNAL void | logMessage (QXmppLogger::MessageType type, const QString &msg)
| This signal is emitted to send logging messages.
Q_SIGNAL void | updateCounter (const QString &counter, qint64 amount=1)
| Updates the given counter by amount.

## Properties
bool | supportedByServer

## Friends
class | QXmppRosterManager
class | tst_QXmppMovedManager

## Additional Inherited Members
Protected Member Functions inherited from QXmppClientExtension
QXmppClient * | client () const
virtual void | setClient (QXmppClient *client)
virtual void | onRegistered (QXmppClient *client)
virtual void | onUnregistered (QXmppClient *client)
void | injectIq (const QDomElement &element, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
bool | injectMessage (QXmppMessage &&message)
Protected Member Functions inherited from QXmppLoggable
void | debug (const QString &message)
| Logs a debugging message.
void | info (const QString &message)
| Logs an informational message.
void | warning (const QString &message)
| Logs a warning message.
void | logReceived (const QString &message)
| Logs a received packet.
void | logSent (const QString &message)
| Logs a sent packet.

## 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>();
QXmppClientExtension::client
QXmppClient * client() const
Definition QXmppClientExtension.cpp:57
QXmppDiscoveryManager
The QXmppDiscoveryManager class makes it possible to discover information about other entities as def...
Definition QXmppDiscoveryManager.h:23
QXmppPubSubManager
The QXmppPubSubManager aims to provide publish-subscribe functionality as specified in XEP-0060: Publ...
Definition QXmppPubSubManager.h:21

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

auto *manager = client->addNewExtension<QXmppMovedManager>();
QXmppMovedManager::QXmppMovedManager
QXmppMovedManager()
Definition QXmppMovedManager.cpp:127

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.

Since
  QXmpp 1.9

## Member Typedef Documentation

## ◆ Result

using QXmppMovedManager::Result = std::variant<QXmpp::Success, QXmppError>

Contains QXmpp::Success or an error.

## Constructor & Destructor Documentation

## ◆ QXmppMovedManager()

QXmppMovedManager::QXmppMovedManager | ( |  | ) |
| explicit

Constructs a XEP-0283: Moved manager.

## Member Function Documentation

## ◆ discoveryFeatures()

QStringList QXmppMovedManager::discoveryFeatures | ( |  | ) | const
| overridevirtual

Returns the discovery features to add to the client.

Reimplemented from QXmppClientExtension.

## ◆ notifyContact()

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.

Parameters

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

Returns
  the result of the action

## ◆ publishStatement()

QXmppTask< QXmppClient::EmptyResult > QXmppMovedManager::publishStatement | ( | const QString & | newBareJid | ) |

Publish a moved statement.

Parameters

  newBareJid | JID of the new account

Returns
  the result of the action

## ◆ supportedByServer()

bool QXmppMovedManager::supportedByServer | ( |  | ) | const

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

Returns
  whether XEP-0283: Moved feature is supported

## ◆ supportedByServerChanged()

Q_SIGNAL void QXmppMovedManager::supportedByServerChanged | ( |  | ) |

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

## ◆ verifyStatement()

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

Verify a user moved statement.

Parameters

  oldBareJid | JID of the old account to check statement
  newBareJid | JID of the new account that send the subscription request

Returns
  the result of the action

## Property Documentation

## ◆ supportedByServer

bool QXmppMovedManager::supportedByServer
| read

See also
  QXmppMovedManager::supportedByServer()

The documentation for this class was generated from the following files:

- QXmppMovedManager.h
- QXmppMovedManager.cpp