use of org.jivesoftware.smackx.iqregister.packet.Registration in project Smack by igniterealtime.
the class MultiUserChat method getRegistrationForm.
/**
* Returns the room's registration form that an unaffiliated user, can use to become a member
* of the room or <code>null</code> if no registration is possible. Some rooms may restrict the
* privilege to register members and allow only room admins to add new members.<p>
*
* If the user requesting registration requirements is not allowed to register with the room
* (e.g. because that privilege has been restricted), the room will return a "Not Allowed"
* error to the user (error code 405).
*
* @return the registration Form that contains the fields to complete together with the
* instrucions or <code>null</code> if no registration is possible.
* @throws XMPPErrorException if an error occurs asking the registration form for the room or a
* 405 error if the user is not allowed to register with the room.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
*/
public Form getRegistrationForm() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Registration reg = new Registration();
reg.setType(IQ.Type.get);
reg.setTo(room);
IQ result = connection.sendIqRequestAndWaitForResponse(reg);
DataForm dataForm = DataForm.from(result);
return new Form(dataForm);
}
Aggregations