From ca8f2ae6ec53e6fa451a43241d9ed7ac07b03364 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Thu, 4 Oct 2018 20:19:38 +0200 Subject: added a few TODOs in regards to the handling of inactive devices --- src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java | 5 +++-- .../java/de/pixart/messenger/crypto/axolotl/XmppAxolotlSession.java | 1 + src/main/java/de/pixart/messenger/ui/EditAccountActivity.java | 2 +- 3 files changed, 5 insertions(+), 3 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 ee2d814f9..9957aa0e0 100644 --- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java +++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java @@ -525,6 +525,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { if (packet.getType() == IqPacket.TYPE.TIMEOUT) { Log.d(Config.LOGTAG, getLogprefix(account) + "Timeout received while retrieving own Device Ids."); } else { + //TODO consider calling registerDevices only after item-not-found to account for broken PEPs Element item = mXmppConnectionService.getIqParser().getItem(packet); Set deviceIds = mXmppConnectionService.getIqParser().deviceIds(item); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": retrieved own device list: " + deviceIds); @@ -1162,8 +1163,8 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { Set addresses = new HashSet<>(); for (Jid jid : getCryptoTargets(conversation)) { Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Finding devices without session for " + jid); - Set ids = deviceIds.get(jid); - if (deviceIds.get(jid) != null && !ids.isEmpty()) { + final Set ids = deviceIds.get(jid); + if (ids != null && !ids.isEmpty()) { for (Integer foreignId : ids) { SignalProtocolAddress address = new SignalProtocolAddress(jid.toString(), foreignId); if (sessions.get(address) == null) { diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlSession.java b/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlSession.java index 09045f032..caa7f9c23 100644 --- a/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlSession.java +++ b/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlSession.java @@ -110,6 +110,7 @@ public class XmppAxolotlSession implements Comparable { } if (!status.isActive()) { setTrust(status.toActive()); + //TODO: also (re)add to device list? } } else { throw new CryptoFailedException("not encrypting omemo message from fingerprint "+getFingerprint()+" because it was marked as compromised"); diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index bc1fcce7a..844be322f 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -1125,7 +1125,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat hasKeys = true; } } - if (hasKeys && Config.supportOmemo()) { + if (hasKeys && Config.supportOmemo()) { //TODO: either the button should be visible if we print an active device or the device list should be fed with reactived devices this.binding.otherDeviceKeysCard.setVisibility(View.VISIBLE); Set otherDevices = mAccount.getAxolotlService().getOwnDeviceIds(); if (otherDevices == null || otherDevices.isEmpty()) { -- cgit v1.2.3