mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 09:39:39 +02:00
Added support for registration instructions (SMACK-90)
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2108 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
1ba31fd633
commit
ac2166a62f
2 changed files with 47 additions and 1 deletions
|
@ -136,6 +136,25 @@ public class AccountManager {
|
|||
return Collections.EMPTY_LIST.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the instructions for creating a new account, or <tt>null</tt> if there
|
||||
* are no instructions. If present, instructions should be displayed to the end-user
|
||||
* that will complete the registration process.
|
||||
*
|
||||
* @return the account creation instructions, or <tt>null</tt> if there are none.
|
||||
*/
|
||||
public String getAccountInstructions() {
|
||||
try {
|
||||
if (info == null) {
|
||||
getRegistrationInfo();
|
||||
}
|
||||
return info.getInstructions();
|
||||
}
|
||||
catch (XMPPException xe) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new account using the specified username and password. The server may
|
||||
* require a number of extra account attributes such as an email address and phone
|
||||
|
@ -149,6 +168,9 @@ public class AccountManager {
|
|||
* @throws XMPPException if an error occurs creating the account.
|
||||
*/
|
||||
public void createAccount(String username, String password) throws XMPPException {
|
||||
if (!supportsAccountCreation()) {
|
||||
throw new XMPPException("Server does not support account creation.");
|
||||
}
|
||||
// Create a map for all the required attributes, but give them blank values.
|
||||
Map attributes = new HashMap();
|
||||
for (Iterator i=getAccountAttributes(); i.hasNext(); ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue