aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppRegistrationManager.h
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2020-02-06 11:49:26 +0100
committerLNJ <lnj@kaidan.im>2020-02-06 12:17:01 +0100
commitfd0e02233f925cff699c08b135887a09bdc16e5c (patch)
tree5eeb54d9c5824d372980a3f50571fbb00d03610c /src/client/QXmppRegistrationManager.h
parentdee612210008007a9c011b96081605f6e692287d (diff)
downloadqxmpp-fd0e02233f925cff699c08b135887a09bdc16e5c.tar.gz
QXmppRegistrationManager: Handle result of deleteAccount()
This adds two signals to make the result easily available to the user.
Diffstat (limited to 'src/client/QXmppRegistrationManager.h')
-rw-r--r--src/client/QXmppRegistrationManager.h30
1 files changed, 21 insertions, 9 deletions
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;
/// <h3>Unregistration with the server</h3>
///
/// 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<QXmppRegistrationManager>();
-/// 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
///
/// <h3 id="register-account">Registering with a server</h3>
@@ -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/
///
@@ -323,6 +325,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.
///
/// To connect with the account you still need to set the correct