QXmpp  Version:1.3.1
QXmppRegistrationManager.h
1 /*
2  * Copyright (C) 2008-2020 The QXmpp developers
3  *
4  * Author:
5  * Melvin Keskin
6  * Linus Jahn
7  *
8  * Source:
9  * https://github.com/qxmpp-project/qxmpp
10  *
11  * This file is a part of QXmpp library.
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public
15  * License as published by the Free Software Foundation; either
16  * version 2.1 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  * Lesser General Public License for more details.
22  *
23  */
24 
25 #ifndef QXMPPREGISTRATIONMANAGER_H
26 #define QXMPPREGISTRATIONMANAGER_H
27 
28 #include "QXmppClientExtension.h"
29 #include "QXmppRegisterIq.h"
30 
31 #include <QScopedPointer>
32 
33 class QXmppRegistrationManagerPrivate;
34 
243 {
244  Q_OBJECT
245 
247  Q_PROPERTY(bool supportedByServer READ supportedByServer NOTIFY supportedByServerChanged)
248 
249 public:
252 
253  QStringList discoveryFeatures() const override;
254 
255  void changePassword(const QString &newPassword);
256  void deleteAccount();
257 
258  // documentation needs to be here, see https://stackoverflow.com/questions/49192523/
270  bool supportedByServer() const;
271 
272  void requestRegistrationForm(const QString &service = {});
273 
274  void setRegistrationFormToSend(const QXmppRegisterIq &iq);
275  void setRegistrationFormToSend(const QXmppDataForm &dataForm);
276  void sendCachedRegistrationForm();
277 
278  bool registerOnConnectEnabled() const;
279  void setRegisterOnConnectEnabled(bool enabled);
280 
282  bool handleStanza(const QDomElement &stanza) override;
284 
285 Q_SIGNALS:
292  void supportedByServerChanged();
293 
301  void passwordChanged(const QString &newPassword);
302 
308  void passwordChangeFailed(QXmppStanza::Error error);
309 
325  void registrationFormReceived(const QXmppRegisterIq &iq);
326 
330  void accountDeleted();
331 
335  void accountDeletionFailed(QXmppStanza::Error error);
336 
343  void registrationSucceeded();
344 
359  void registrationFailed(const QXmppStanza::Error &error);
360 
361 protected:
362  void setClient(QXmppClient *client) override;
363 
364 private Q_SLOTS:
365  void handleDiscoInfo(const QXmppDiscoveryIq &iq);
366 
367 private:
368  void setSupportedByServer(bool supportedByServer);
369 
370  QScopedPointer<QXmppRegistrationManagerPrivate> d;
371 };
372 
373 #endif // QXMPPREGISTRATIONMANAGER_H
QXmppStanza::Error
The Error class represents a stanza error.
Definition: QXmppStanza.h:105
QXmppDataForm
The QXmppDataForm class represents a data form as defined by XEP-0004: Data Forms.
Definition: QXmppDataForm.h:48
QXmppClientExtension
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:47
QXmppClientExtension::setClient
virtual void setClient(QXmppClient *client)
Definition: QXmppClientExtension.cpp:79
QXmppClientExtension::discoveryFeatures
virtual QStringList discoveryFeatures() const
Definition: QXmppClientExtension.cpp:54
QXmppRegistrationManager
The QXmppRegistrationManager class manages in-band registration and account management tasks like cha...
Definition: QXmppRegistrationManager.h:242
QXmppClient
The QXmppClient class is the main class for using QXmpp.
Definition: QXmppClient.h:94
QXmppRegisterIq
The QXmppRegisterIq class represents a registration IQ as defined by XEP-0077: In-Band Registration.
Definition: QXmppRegisterIq.h:41
QXmppClientExtension::handleStanza
virtual bool handleStanza(const QDomElement &stanza)=0
You need to implement this method to process incoming XMPP stanzas.
QXmppDiscoveryIq
QXmppDiscoveryIq represents a discovery IQ request or result containing a list of features and other ...
Definition: QXmppDiscoveryIq.h:43