#include <registration.h>
Inherits IqHandler.
Inheritance diagram for Registration:


Public Types | |
| enum | fieldEnum |
Public Member Functions | |
| Registration (ClientBase *parent, const JID &to) | |
| Registration (ClientBase *parent) | |
| virtual | ~Registration () |
| void | fetchRegistrationFields () |
| void | createAccount (int fields, const RegistrationFields &values) |
| void | createAccount (const DataForm &form) |
| void | removeAccount () |
| void | changePassword (const std::string &username, const std::string &password) |
| void | registerRegistrationHandler (RegistrationHandler *rh) |
| void | removeRegistrationHandler () |
| virtual bool | handleIq (Stanza *) |
| virtual bool | handleIqID (Stanza *stanza, int context) |
Derive your object from RegistrationHandler and implement the virtual functions offered by that interface. Then use it like this:
void MyClass::myFunc() { m_client = new Client( "example.org" ); m_client->disableRoster(); // a roster is not necessary for registration m_client->registerConnectionListener( this ); m_reg = new Registration( c ); m_reg->registerRegistrationHandler( this ); m_client->connect(); } void MyClass::onConnect() { m_reg->fetchRegistrationFields(); }
In RegistrationHandler::handleRegistrationFields() you should check which information the server requires to open a new account. You might not always get away with just username and password. Then call createAccount() with a filled-in RegistrationFields and an int representing the bit-wise ORed fields you want to have included in the registration attempt. For your convenience you can use the 'fields' argument of handleRegistrationFields(). ;) It's your responsibility to make sure at least those fields the server requested are filled in.
Check tests/register_test.cpp for an example.
Definition at line 91 of file registration.h.
|
|
The possible fields of a XEP-0077 account registration. Definition at line 98 of file registration.h. |
|
||||||||||||
|
Constructor.
Definition at line 24 of file registration.cpp. |
|
|
Constructor. Registration will be attempted with the ClientBase's connected host.
Definition at line 30 of file registration.cpp. |
|
|
Virtual destructor. Definition at line 42 of file registration.cpp. |
|
||||||||||||
|
Tells the server to change the password for the current account.
Definition at line 163 of file registration.cpp. |
|
|
Attempts to register an account with the given credentials. This can only be called with an unauthenticated parent (Client).
Definition at line 122 of file registration.cpp. |
|
||||||||||||
|
Attempts to register an account with the given credentials. Only the fields OR'ed in
Definition at line 70 of file registration.cpp. |
|
|
Use this function to request the registration fields the server requires. The required fields are returned asynchronously to the object registered as RegistrationHandler by calling RegistrationHandler::handleRegistrationFields(). Definition at line 51 of file registration.cpp. |
|
|
Reimplement this function if you want to be notified about incoming IQs.
Implements IqHandler. Definition at line 189 of file registration.h. |
|
||||||||||||
|
Reimplement this function if you want to be notified about incoming IQs with a specific value of the
Implements IqHandler. Definition at line 194 of file registration.cpp. |
|
|
Registers the given
Definition at line 184 of file registration.cpp. |
|
|
Tells the server to remove the currently authenticated account from the server. Definition at line 142 of file registration.cpp. |
|
|
Un-registers the current RegistrationHandler. Definition at line 189 of file registration.cpp. |
1.4.1