From 8246154a36321b2d45a5e1df3caf6e6b124f4720 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sun, 13 Aug 2017 23:21:33 +0200 Subject: create a new axolotl service when the account jid changes --- .../de/pixart/messenger/crypto/axolotl/AxolotlService.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/main/java/de/pixart/messenger/crypto') 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 0aa797aff..87d37788c 100644 --- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java +++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java @@ -263,6 +263,9 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { } public AxolotlService(Account account, XmppConnectionService connectionService) { + if (account == null || connectionService == null) { + throw new IllegalArgumentException("account and service cannot be null"); + } if (Security.getProvider("BC") == null) { Security.addProvider(new BouncyCastleProvider()); } @@ -360,6 +363,16 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { publishBundlesIfNeeded(true, wipeOther); } + public void destroy() { + Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": destroying old axolotl service. no longer in use"); + mXmppConnectionService.databaseBackend.wipeAxolotlDb(account); + } + + public AxolotlService makeNew() { + Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": make new axolotl service"); + return new AxolotlService(this.account, this.mXmppConnectionService); + } + public int getOwnDeviceId() { return axolotlStore.getLocalRegistrationId(); } -- cgit v1.2.3