From fd0e02233f925cff699c08b135887a09bdc16e5c Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Thu, 6 Feb 2020 11:49:26 +0100 Subject: QXmppRegistrationManager: Handle result of deleteAccount() This adds two signals to make the result easily available to the user. --- src/client/QXmppRegistrationManager.h | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'src/client/QXmppRegistrationManager.h') diff --git a/src/client/QXmppRegistrationManager.h b/src/client/QXmppRegistrationManager.h index eba49d53..712fc9b6 100644 --- a/src/client/QXmppRegistrationManager.h +++ b/src/client/QXmppRegistrationManager.h @@ -92,17 +92,19 @@ class QXmppRegistrationManagerPrivate; ///

Unregistration with the server

/// /// If you want to delete your account on the server, you can do that using -/// deleteAccount(). The result of the IQ request is not handled. If you want -/// to do that manually, you can use the returned ID. +/// deleteAccount(). When the result is received either accountDeleted() or +/// accountDeletionFailed() is emitted. In case it was successful the manager +/// automatically disconnects from the client. /// /// \code /// auto *registrationManager = client->findExtension(); -/// QString deleteId = registrationManager->deleteAccount(); -/// if (deleteId.isEmpty()) { -/// // stanza could not be sent -/// } else { -/// // stanza was sent, you can handle the result using deleteId -/// } +/// connect(registrationManager, &QXmppRegistrationManager::accountDeleted, [=]() { +/// qDebug() << "Account deleted successfull, the client is disconnecting now"; +/// }); +/// connect(registrationManager, &QXmppRegistrationManager::accountDeletionFailed, [=](QXmppStanza::Error error) { +/// qDebug() << "Couldn't delete account:" << error.text(); +/// }); +/// registrationManager->deleteAccount(); /// \endcode /// ///

Registering with a server

@@ -251,7 +253,7 @@ public: QStringList discoveryFeatures() const override; void changePassword(const QString &newPassword); - QString deleteAccount(); + void deleteAccount(); // documentation needs to be here, see https://stackoverflow.com/questions/49192523/ /// @@ -322,6 +324,16 @@ signals: /// void registrationFormReceived(const QXmppRegisterIq &iq); + /// + /// Emitted, when the account was deleted successfully. + /// + void accountDeleted(); + + /// + /// Emitted, when the account could not be deleted. + /// + void accountDeletionFailed(QXmppStanza::Error error); + /// /// Emitted, when the registration with a service completed successfully. /// -- cgit v1.2.3