Module author: Sylvain Hellegouarch <sh@defuze.org>
To register a new user you can simply create an instance of the Register class.
>>> from headstock.client import AsyncClient
>>> c = AsyncClient(u'user@domain', u'secret', hostname='localhost', port=5222, registerclass=Register)
>>> c.set_log(stdout=True)
>>> c.run()
You will not have much control over the XMPP exchange.
When you want to react at what happens during the XMPP exchange, you should subclass the Register class and implement:
handle_register_success(e)
handle_register_conflict(e)
handle_resource_constraint(e)
Default class to register a user. This will perform the actual register exchange.
client headstock.client.BaseClient instance
username username expected to be registered
password chosen password for the account
email None - account’s email
Called when the username is already used on the server.
Does nothing by default.
e bridge.Element instance representing the dispatched stanza
Handler called when the server replies a IQ stanza indicating the registration succeeded.
Does nothing by default.
e bridge.Element instance representing the dispatched stanza
Handler called when the server sends the registration form and returns the same form filled with at least the username and password.
e bridge.Element instance representing the dispatched stanza
Called when the server limits the resources it allows to this connection.
Raises a headstock.error.HeadstockStreamError instance.
e bridge.Element instance representing the dispatched stanza
Handler called when the <register xmlns=”http://jabber.org/features/iq-register” /> stanza is received and the client required the registration process.
Returns a stanza indicating the client is indeed requesting the registration process from the server.
e bridge.Element instance representing the dispatched stanza