public final 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(org.jxmpp.jid.parts.Localpart username,
java.lang.String password)
Creates a new account using the specified username and password.
|
void |
createAccount(org.jxmpp.jid.parts.Localpart 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.Set<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 |
isSupported() |
void |
sensitiveOperationOverInsecureConnection(boolean allow)
Set to
true to allow sensitive operation over insecure connection. |
static void |
sensitiveOperationOverInsecureConnectionDefault(boolean allow)
The default value used by new account managers for
allowSensitiveOperationOverInsecureConnection. |
boolean |
supportsAccountCreation()
Returns true if the server supports creating new accounts.
|
connection, getAuthenticatedConnectionOrThrow, schedulepublic static AccountManager getInstance(XMPPConnection connection)
connection - the connection used to look for the proper ServiceDiscoveryManager.public static void sensitiveOperationOverInsecureConnectionDefault(boolean allow)
allowSensitiveOperationOverInsecureConnection.allow - sensitiveOperationOverInsecureConnection(boolean)public void sensitiveOperationOverInsecureConnection(boolean allow)
true to allow sensitive operation over insecure connection.
Set to true to allow sensitive operations like account creation or password changes over an insecure (e.g. unencrypted) connections.
allow - public boolean supportsAccountCreation() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
XMPPException.XMPPErrorExceptionSmackException.NoResponseExceptionSmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic java.util.Set<java.lang.String> getAccountAttributes() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
Typically, servers require no attributes when creating new accounts, or just the user's email address.
XMPPException.XMPPErrorExceptionSmackException.NoResponseExceptionSmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic java.lang.String getAccountAttribute(java.lang.String name) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
name - the name of the account attribute to return its value.XMPPException.XMPPErrorExceptionSmackException.NoResponseExceptionSmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic java.lang.String getAccountInstructions() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
XMPPException.XMPPErrorExceptionSmackException.NoResponseExceptionSmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic void createAccount(org.jxmpp.jid.parts.Localpart username, java.lang.String password) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
username - the username.password - the password.XMPPException.XMPPErrorExceptionSmackException.NoResponseExceptionSmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic void createAccount(org.jxmpp.jid.parts.Localpart username, java.lang.String password, java.util.Map<java.lang.String,java.lang.String> attributes) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
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.NotConnectedExceptionjava.lang.InterruptedExceptiongetAccountAttributes()public void changePassword(java.lang.String newPassword) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
newPassword - new password.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.NotConnectedExceptionjava.lang.InterruptedExceptionpublic void deleteAccount() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
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.NotConnectedExceptionjava.lang.InterruptedExceptionpublic boolean isSupported() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
SmackException.NoResponseExceptionXMPPException.XMPPErrorExceptionSmackException.NotConnectedExceptionjava.lang.InterruptedException