delete omemo keys when deleting account

This commit is contained in:
Daniel Gultsch 2019-09-28 21:52:07 +02:00
parent 175d9f539e
commit 9276eff1db
2 changed files with 9 additions and 1 deletions

View file

@ -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<Jid> getCryptoTargets(Conversation conversation) {
final List<Jid> jids;
if (conversation.getMode() == Conversation.MODE_SINGLE) {

View file

@ -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)) {