public final class AccountManager
extends org.jivesoftware.smack.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(org.jivesoftware.smack.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.
|
public static AccountManager getInstance(org.jivesoftware.smack.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 org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException
public java.util.Set<java.lang.String> getAccountAttributes() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Typically, servers require no attributes when creating new accounts, or just the user's email address.
org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException
public java.lang.String getAccountAttribute(java.lang.String name) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
name
- the name of the account attribute to return its value.org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException
public java.lang.String getAccountInstructions() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException
public void createAccount(org.jxmpp.jid.parts.Localpart username, java.lang.String password) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
username
- the username.password
- the password.org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException
public void createAccount(org.jxmpp.jid.parts.Localpart username, java.lang.String password, java.util.Map<java.lang.String,java.lang.String> attributes) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
username
- the username.password
- the password.attributes
- the account attributes.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if an error occurs creating the account.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException
getAccountAttributes()
public void changePassword(java.lang.String newPassword) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
java.lang.IllegalStateException
- if not currently logged-in to the server.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if an error occurs when changing the password.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException
public void deleteAccount() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
java.lang.IllegalStateException
- if not currently logged-in to the server.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if an error occurs when deleting the account.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException
public boolean isSupported() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException