diff options
Diffstat (limited to 'src/base')
| -rw-r--r-- | src/base/QXmppRegisterIq.cpp | 36 | ||||
| -rw-r--r-- | src/base/QXmppRegisterIq.h | 5 |
2 files changed, 40 insertions, 1 deletions
diff --git a/src/base/QXmppRegisterIq.cpp b/src/base/QXmppRegisterIq.cpp index 79231c9a..de96aee9 100644 --- a/src/base/QXmppRegisterIq.cpp +++ b/src/base/QXmppRegisterIq.cpp @@ -65,6 +65,42 @@ QXmppRegisterIq::~QXmppRegisterIq() = default; QXmppRegisterIq &QXmppRegisterIq::operator=(const QXmppRegisterIq &other) = default; +/// Constructs a regular change password request. +/// +/// \param username The username of the account of which the password should be +/// changed. +/// \param newPassword The new password that should be set. +/// \param to Optional JID of the registration service. If this is omitted, the +/// IQ is automatically addressed to the local server. +/// +/// \since QXmpp 1.2 + +QXmppRegisterIq QXmppRegisterIq::createChangePasswordRequest(const QString &username, const QString &newPassword, const QString &to) +{ + QXmppRegisterIq iq; + iq.setType(QXmppIq::Set); + iq.setTo(to); + iq.setUsername(username); + iq.setPassword(newPassword); + return iq; +} + +/// Constructs a regular unregistration request. +/// +/// \param to Optional JID of the registration service. If this is omitted, the +/// IQ is automatically addressed to the local server. +/// +/// \since QXmpp 1.2 + +QXmppRegisterIq QXmppRegisterIq::createUnregistrationRequest(const QString &to) +{ + QXmppRegisterIq iq; + iq.setType(QXmppIq::Set); + iq.setTo(to); + iq.setRegisterType(QXmppRegisterIq::Remove); + return iq; +} + /// Returns the email for this registration IQ. QString QXmppRegisterIq::email() const diff --git a/src/base/QXmppRegisterIq.h b/src/base/QXmppRegisterIq.h index f952541d..83b53bc1 100644 --- a/src/base/QXmppRegisterIq.h +++ b/src/base/QXmppRegisterIq.h @@ -47,7 +47,7 @@ public: enum RegisterType { None, ///< No special register IQ. - Registered, ///< Used by the service to indicate that an account is already registered. + Registered, ///< Used by the service to indicate that an account is registered. Remove ///< Used by the client to request account removal. }; @@ -57,6 +57,9 @@ public: QXmppRegisterIq &operator=(const QXmppRegisterIq &other); + static QXmppRegisterIq createChangePasswordRequest(const QString &username, const QString &newPassword, const QString &to = {}); + static QXmppRegisterIq createUnregistrationRequest(const QString &to = {}); + QString email() const; void setEmail(const QString &email); |
