diff options
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(); } |