do not init connection for disabled accounts
This commit is contained in:
parent
2dd8896dc2
commit
928db01ae8
|
@ -4118,12 +4118,17 @@ public class XmppConnectionService extends Service {
|
||||||
|
|
||||||
private void reconnectAccount(final Account account, final boolean force, final boolean interactive) {
|
private void reconnectAccount(final Account account, final boolean force, final boolean interactive) {
|
||||||
synchronized (account) {
|
synchronized (account) {
|
||||||
XmppConnection connection = account.getXmppConnection();
|
final XmppConnection existingConnection = account.getXmppConnection();
|
||||||
if (connection == null) {
|
final XmppConnection connection;
|
||||||
|
if (existingConnection != null) {
|
||||||
|
connection = existingConnection;
|
||||||
|
} else if (account.isConnectionEnabled()) {
|
||||||
connection = createConnection(account);
|
connection = createConnection(account);
|
||||||
account.setXmppConnection(connection);
|
account.setXmppConnection(connection);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
boolean hasInternet = hasInternetConnection();
|
final boolean hasInternet = hasInternetConnection();
|
||||||
if (account.isConnectionEnabled() && hasInternet) {
|
if (account.isConnectionEnabled() && hasInternet) {
|
||||||
if (!force) {
|
if (!force) {
|
||||||
disconnect(account, false);
|
disconnect(account, false);
|
||||||
|
|
Loading…
Reference in a new issue