diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-09-29 14:19:30 +0200 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-09-29 14:19:30 +0200 |
commit | 7375f240417996aab2ba01f02ded38d87a94e33b (patch) | |
tree | f738b3bf9a210dd7cc6c9eece61b2aefd916d47a /src/main/java | |
parent | d852745b2ca59610a0b8f2271545befd697ec7a8 (diff) |
account deletion: only attempt to delete omemo id when connected
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 2c23b6ed0..083f996cc 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -2488,21 +2488,24 @@ public class XmppConnectionService extends Service { } public void deleteAccount(final Account account) { + final boolean connected = account.getStatus() == Account.State.ONLINE; synchronized (this.conversations) { - account.getAxolotlService().deleteOmemoIdentity(); + if (connected) { + account.getAxolotlService().deleteOmemoIdentity(); + } for (final Conversation conversation : conversations) { if (conversation.getAccount() == account) { if (conversation.getMode() == Conversation.MODE_MULTI) { - leaveMuc(conversation); - } else if (conversation.getMode() == Conversation.MODE_SINGLE) { - conversation.endOtrIfNeeded(); + if (connected) { + leaveMuc(conversation); + } } - mNotificationService.clear(conversation); conversations.remove(conversation); + mNotificationService.clear(conversation); } } if (account.getXmppConnection() != null) { - new Thread(() -> disconnect(account, false)).start(); + new Thread(() -> disconnect(account, !connected)).start(); } final Runnable runnable = () -> { if (!databaseBackend.deleteAccount(account)) { |