X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/2d068997c50e8e75e378e9f0202aa14de3a140a8..8f781c019f5f451c9d6323659bb248be335ad0e5:/lib/src/main/java/org/asamk/signal/manager/Manager.java diff --git a/lib/src/main/java/org/asamk/signal/manager/Manager.java b/lib/src/main/java/org/asamk/signal/manager/Manager.java index 37b4aa86..ef0b404b 100644 --- a/lib/src/main/java/org/asamk/signal/manager/Manager.java +++ b/lib/src/main/java/org/asamk/signal/manager/Manager.java @@ -618,21 +618,27 @@ public class Manager implements Closeable { return null; } + profile = decryptProfileIfKeyKnown(recipientId, encryptedProfile); + account.getProfileStore().storeProfile(recipientId, profile); + + return profile; + } + + private Profile decryptProfileIfKeyKnown( + final RecipientId recipientId, final SignalServiceProfile encryptedProfile + ) { var profileKey = account.getProfileStore().getProfileKey(recipientId); if (profileKey == null) { - profile = new Profile(System.currentTimeMillis(), + return new Profile(System.currentTimeMillis(), null, null, null, null, ProfileUtils.getUnidentifiedAccessMode(encryptedProfile, null), ProfileUtils.getCapabilities(encryptedProfile)); - } else { - profile = decryptProfileAndDownloadAvatar(recipientId, profileKey, encryptedProfile); } - account.getProfileStore().storeProfile(recipientId, profile); - return profile; + return decryptProfileAndDownloadAvatar(recipientId, profileKey, encryptedProfile); } private SignalServiceProfile retrieveEncryptedProfile(RecipientId recipientId) { @@ -2077,7 +2083,7 @@ public class Manager implements Closeable { var hasCaughtUpWithOldMessages = false; - while (true) { + while (!Thread.interrupted()) { SignalServiceEnvelope envelope; SignalServiceContent content = null; Exception exception = null;