From fcd9ab17fe8ca9d005e048640ee36cb5fd2271b0 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 28 Dec 2016 22:15:24 +0100 Subject: don't throw assertion error when building session with same device id from other contact --- .../java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java index 8f586f3a..7f54ce2f 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -364,6 +364,10 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { return axolotlStore.getLocalRegistrationId(); } + public AxolotlAddress getOwnAxolotlAddress() { + return new AxolotlAddress(account.getJid().toBareJid().toPreppedString(),getOwnDeviceId()); + } + public Set getOwnDeviceIds() { return this.deviceIds.get(account.getJid().toBareJid()); } @@ -453,6 +457,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { } else { Element item = mXmppConnectionService.getIqParser().getItem(packet); Set deviceIds = mXmppConnectionService.getIqParser().deviceIds(item); + Log.d(Config.LOGTAG,account.getJid().toBareJid()+": retrieved own device list: "+deviceIds); registerDevices(account.getJid().toBareJid(),deviceIds); } } @@ -822,7 +827,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { private void buildSessionFromPEP(final AxolotlAddress address) { Log.i(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Building new session for " + address.toString()); - if (address.getDeviceId() == getOwnDeviceId()) { + if (address.equals(getOwnAxolotlAddress())) { throw new AssertionError("We should NEVER build a session with ourselves. What happened here?!"); } -- cgit v1.2.3