public class AccountManager extends Manager
| Modifier and Type | Method and Description |
|---|---|
void |
changePassword(java.lang.String newPassword)
Changes the password of the currently logged-in account.
|
void |
createAccount(java.lang.String username,
java.lang.String password)
Creates a new account using the specified username and password.
|
void |
createAccount(java.lang.String username,
java.lang.String password,
java.util.Map<java.lang.String,java.lang.String> attributes)
Creates a new account using the specified username, password and account attributes.
|
void |
deleteAccount()
Deletes the currently logged-in account from the server.
|
java.lang.String |
getAccountAttribute(java.lang.String name)
Returns the value of a given account attribute or null if the account
attribute wasn't found.
|
java.util.Collection<java.lang.String> |
getAccountAttributes()
Returns an unmodifiable collection of the names of the required account attributes.
|
java.lang.String |
getAccountInstructions()
Returns the instructions for creating a new account, or null if there
are no instructions.
|
static AccountManager |
getInstance(XMPPConnection connection)
Returns the AccountManager instance associated with a given XMPPConnection.
|
boolean |
supportsAccountCreation()
Returns true if the server supports creating new accounts.
|
connection, schedulepublic static AccountManager getInstance(XMPPConnection connection)
connection - the connection used to look for the proper ServiceDiscoveryManager.public boolean supportsAccountCreation()
throws SmackException.NoResponseException,
XMPPException.XMPPErrorException,
SmackException.NotConnectedException
XMPPException.XMPPErrorExceptionSmackException.NoResponseExceptionSmackException.NotConnectedExceptionpublic java.util.Collection<java.lang.String> getAccountAttributes()
throws SmackException.NoResponseException,
XMPPException.XMPPErrorException,
SmackException.NotConnectedException
Typically, servers require no attributes when creating new accounts, or just the user's email address.
XMPPException.XMPPErrorExceptionSmackException.NoResponseExceptionSmackException.NotConnectedExceptionpublic java.lang.String getAccountAttribute(java.lang.String name)
throws SmackException.NoResponseException,
XMPPException.XMPPErrorException,
SmackException.NotConnectedException
name - the name of the account attribute to return its value.XMPPException.XMPPErrorExceptionSmackException.NoResponseExceptionSmackException.NotConnectedExceptionpublic java.lang.String getAccountInstructions()
throws SmackException.NoResponseException,
XMPPException.XMPPErrorException,
SmackException.NotConnectedException
XMPPException.XMPPErrorExceptionSmackException.NoResponseExceptionSmackException.NotConnectedExceptionpublic void createAccount(java.lang.String username,
java.lang.String password)
throws SmackException.NoResponseException,
XMPPException.XMPPErrorException,
SmackException.NotConnectedException
username - the username.password - the password.XMPPException.XMPPErrorExceptionSmackException.NoResponseExceptionSmackException.NotConnectedExceptionpublic void createAccount(java.lang.String username,
java.lang.String password,
java.util.Map<java.lang.String,java.lang.String> attributes)
throws SmackException.NoResponseException,
XMPPException.XMPPErrorException,
SmackException.NotConnectedException
username - the username.password - the password.attributes - the account attributes.XMPPException.XMPPErrorException - if an error occurs creating the account.SmackException.NoResponseException - if there was no response from the server.SmackException.NotConnectedExceptiongetAccountAttributes()public void changePassword(java.lang.String newPassword)
throws SmackException.NoResponseException,
XMPPException.XMPPErrorException,
SmackException.NotConnectedException
java.lang.IllegalStateException - if not currently logged-in to the server.XMPPException.XMPPErrorException - if an error occurs when changing the password.SmackException.NoResponseException - if there was no response from the server.SmackException.NotConnectedExceptionpublic void deleteAccount()
throws SmackException.NoResponseException,
XMPPException.XMPPErrorException,
SmackException.NotConnectedException
java.lang.IllegalStateException - if not currently logged-in to the server.XMPPException.XMPPErrorException - if an error occurs when deleting the account.SmackException.NoResponseException - if there was no response from the server.SmackException.NotConnectedException