QXmpp Version: 1.10.0
Public Types | Public Member Functions | Properties | Friends | List of all members
QXmppMovedManager Class Reference
Inheritance diagram for QXmppMovedManager:
Inheritance graph
[legend]
Collaboration diagram for QXmppMovedManager:
Collaboration graph
[legend]

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< ResultpublishStatement (const QString &newBareJid)
 
QXmppTask< ResultverifyStatement (const QString &oldBareJid, const QString &newBareJid)
 
QXmppTask< QXmpp::SendResultnotifyContact (const QString &contactBareJid, const QString &oldBareJid, bool sensitive=true, const QString &reason={})
 
- Public Member Functions inherited from QXmppClientExtension
 QXmppClientExtension ()
 
virtual QStringList discoveryFeatures () const
 
virtual QList< QXmppDiscoveryIq::IdentitydiscoveryIdentities () const
 
virtual bool handleStanza (const QDomElement &stanza)
 You need to implement this method to process incoming XMPP stanzas. More...
 
virtual bool handleStanza (const QDomElement &stanza, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
 You need to implement this method to process incoming XMPP stanzas. More...
 
- Public Member Functions inherited from QXmppLoggable
 QXmppLoggable (QObject *parent=nullptr)
 

Properties

bool supportedByServer
 

Friends

class QXmppRosterManager
 
class tst_QXmppMovedManager
 

Additional Inherited Members

- Signals inherited from QXmppLoggable
void setGauge (const QString &gauge, double value)
 Sets the given gauge to value.
 
void logMessage (QXmppLogger::MessageType type, const QString &msg)
 This signal is emitted to send logging messages.
 
void updateCounter (const QString &counter, qint64 amount=1)
 Updates the given counter by amount.
 
- Protected Member Functions inherited from QXmppClientExtension
QXmppClientclient () 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)
 
void info (const QString &message)
 
void warning (const QString &message)
 
void logReceived (const QString &message)
 
void logSent (const QString &message)
 

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:

QXmppClient * client() const
Definition: QXmppClientExtension.cpp:57
T * addNewExtension(Args... args)
Definition: QXmppClient.h:117
The QXmppDiscoveryManager class makes it possible to discover information about other entities as def...
Definition: QXmppDiscoveryManager.h:26
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:

Definition: QXmppMovedManager.h:17

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

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
contactBareJidJID of the contact to send the subscription request
oldBareJidJID of the old account we moved from
sensitiveIf true the notification is sent sensitively
reasonThe reason of the move
Returns
the result of the action

◆ publishStatement()

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

Publish a moved statement.

Parameters
newBareJidJID 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()

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
oldBareJidJID of the old account to check statement
newBareJidJID of the new account that send the subscription request
Returns
the result of the action

Property Documentation

◆ supportedByServer

QXmppMovedManager::supportedByServer
read

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