diff options
-rw-r--r-- | src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java | 12 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 3 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java index 444bcf717..53b4e4d69 100644 --- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java +++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java @@ -2,11 +2,12 @@ package de.pixart.messenger.crypto.axolotl; import android.os.Bundle; import android.security.KeyChain; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import android.util.Log; import android.util.Pair; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKeyPair; @@ -839,6 +840,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<Jid> getCryptoTargets(Conversation conversation) { final List<Jid> jids; if (conversation.getMode() == Conversation.MODE_SINGLE) { diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 55ad48954..2c23b6ed0 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -2489,6 +2489,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) { @@ -2501,7 +2502,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)) { |