diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java index b804f4222..59ff20fe5 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -839,6 +839,13 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { }); } + public void deleteOmemoIdentity() { + final String node = AxolotlService.PEP_BUNDLES + ":" + getOwnDeviceId(); + final IqPacket deleteBundleNode = mXmppConnectionService.getIqGenerator().deleteNode(node); + mXmppConnectionService.sendIqPacket(account, deleteBundleNode, null); + publishDeviceIdsAndRefineAccessModel(getOwnDeviceIds()); + } + public List getCryptoTargets(Conversation conversation) { final List jids; if (conversation.getMode() == Conversation.MODE_SINGLE) { diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 68db573a9..cacb1404e 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2199,6 +2199,7 @@ public class XmppConnectionService extends Service { public void deleteAccount(final Account account) { synchronized (this.conversations) { + account.getAxolotlService().deleteOmemoIdentity(); for (final Conversation conversation : conversations) { if (conversation.getAccount() == account) { if (conversation.getMode() == Conversation.MODE_MULTI) { @@ -2209,7 +2210,7 @@ public class XmppConnectionService extends Service { } } if (account.getXmppConnection() != null) { - new Thread(() -> disconnect(account, true)).start(); + new Thread(() -> disconnect(account, false)).start(); } final Runnable runnable = () -> { if (!databaseBackend.deleteAccount(account)) {