QXmpp  Version: 1.10.4
QXmppRegistrationManager.h
1 // SPDX-FileCopyrightText: 2019 Melvin Keskin <melvo@olomono.de>
2 // SPDX-FileCopyrightText: 2019 Linus Jahn <lnj@kaidan.im>
3 //
4 // SPDX-License-Identifier: LGPL-2.1-or-later
5 
6 #ifndef QXMPPREGISTRATIONMANAGER_H
7 #define QXMPPREGISTRATIONMANAGER_H
8 
9 #include "QXmppClientExtension.h"
10 #include "QXmppRegisterIq.h"
11 
12 class QXmppRegistrationManagerPrivate;
13 
225 {
226  Q_OBJECT
227 
229  Q_PROPERTY(bool supportedByServer READ supportedByServer NOTIFY supportedByServerChanged)
230 
231 public:
234 
235  QStringList discoveryFeatures() const override;
236 
237  void changePassword(const QString &newPassword);
238  void deleteAccount();
239 
240  // documentation needs to be here, see https://stackoverflow.com/questions/49192523/
252  bool supportedByServer() const;
253 
254  void requestRegistrationForm(const QString &service = {});
255 
256  void setRegistrationFormToSend(const QXmppRegisterIq &iq);
257  void setRegistrationFormToSend(const QXmppDataForm &dataForm);
258  void sendCachedRegistrationForm();
259 
260  bool registerOnConnectEnabled() const;
261  void setRegisterOnConnectEnabled(bool enabled);
262 
264  bool handleStanza(const QDomElement &stanza) override;
266 
267 Q_SIGNALS:
274  void supportedByServerChanged();
275 
283  void passwordChanged(const QString &newPassword);
284 
290  void passwordChangeFailed(QXmppStanza::Error error);
291 
300  void registrationFormReceived(const QXmppRegisterIq &iq);
301 
305  void accountDeleted();
306 
310  void accountDeletionFailed(QXmppStanza::Error error);
311 
318  void registrationSucceeded();
319 
334  void registrationFailed(const QXmppStanza::Error &error);
335 
336 protected:
337  void onRegistered(QXmppClient *client) override;
338  void onUnregistered(QXmppClient *client) override;
339 
340 private:
341  void handleDiscoInfo(const QXmppDiscoveryIq &iq);
342  void setSupportedByServer(bool supportedByServer);
343  void handleAccountDeleted();
344 
345  const std::unique_ptr<QXmppRegistrationManagerPrivate> d;
346 };
347 
348 #endif // QXMPPREGISTRATIONMANAGER_H
virtual void onRegistered(QXmppClient *client)
Definition: QXmppClientExtension.cpp:85
The QXmppRegisterIq class represents a registration IQ as defined by XEP-0077: In-Band Registration...
Definition: QXmppRegisterIq.h:22
virtual void onUnregistered(QXmppClient *client)
Definition: QXmppClientExtension.cpp:95
virtual bool handleStanza(const QDomElement &stanza)
You need to implement this method to process incoming XMPP stanzas.
Definition: client/compat/removed_api.cpp:26
Definition: QXmppDataForm.h:26
Definition: QXmppDiscoveryIq.h:17
The QXmppRegistrationManager class manages in-band registration and account management tasks like cha...
Definition: QXmppRegistrationManager.h:224
virtual QStringList discoveryFeatures() const
Definition: QXmppClientExtension.cpp:22
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:31
The Error class represents a stanza error.
Definition: QXmppStanza.h:93
Main class for starting and managing connections to XMPP servers.
Definition: QXmppClient.h:61