do not init connection for disabled accounts

This commit is contained in:
Daniel Gultsch 2023-10-19 08:54:19 +02:00
parent 2dd8896dc2
commit 928db01ae8
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2

View file

@ -4118,12 +4118,17 @@ public class XmppConnectionService extends Service {
private void reconnectAccount(final Account account, final boolean force, final boolean interactive) {
synchronized (account) {
XmppConnection connection = account.getXmppConnection();
if (connection == null) {
final XmppConnection existingConnection = account.getXmppConnection();
final XmppConnection connection;
if (existingConnection != null) {
connection = existingConnection;
} else if (account.isConnectionEnabled()) {
connection = createConnection(account);
account.setXmppConnection(connection);
} else {
return;
}
boolean hasInternet = hasInternetConnection();
final boolean hasInternet = hasInternetConnection();
if (account.isConnectionEnabled() && hasInternet) {
if (!force) {
disconnect(account, false);