From 928db01ae86492339d23e0128fed1407817df0c8 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 19 Oct 2023 08:54:19 +0200 Subject: [PATCH] do not init connection for disabled accounts --- .../conversations/services/XmppConnectionService.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 2049f9b95..3cf82d319 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -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);