diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-08-13 23:21:33 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-08-13 23:21:33 +0200 |
commit | 8246154a36321b2d45a5e1df3caf6e6b124f4720 (patch) | |
tree | d9035b05b44accd56826aaf0d252258c56a7de53 /src/main/java/de/pixart/messenger/crypto/axolotl | |
parent | 532aadea3afaac7f03e412eb23cbe9587fa8b94a (diff) |
create a new axolotl service when the account jid changes
Diffstat (limited to 'src/main/java/de/pixart/messenger/crypto/axolotl')
-rw-r--r-- | src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java | 13 |
1 files changed, 13 insertions, 0 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 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(); } |