]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/manager/Manager.java
Move decrypting recipient profile to separate method
[signal-cli] / src / main / java / org / asamk / signal / manager / Manager.java
index 9515a2fd89af552cf5232141e0e4c832c2f3f380..2b561304de33607a447967004b86a3d82062f90a 100644 (file)
@@ -425,7 +425,7 @@ public class Manager implements Closeable {
                 account.getDeviceId(), account.getSignalProtocolStore(), userAgent, account.isMultiDevice(), attachmentsV3, Optional.fromNullable(messagePipe), Optional.fromNullable(unidentifiedMessagePipe), Optional.absent(), clientZkProfileOperations);
     }
 
-    private SignalServiceProfile getRecipientProfile(SignalServiceAddress address, Optional<UnidentifiedAccess> unidentifiedAccess) throws IOException {
+    private SignalServiceProfile getEncryptedRecipientProfile(SignalServiceAddress address, Optional<UnidentifiedAccess> unidentifiedAccess) throws IOException {
         SignalServiceMessagePipe pipe = unidentifiedMessagePipe != null && unidentifiedAccess.isPresent() ? unidentifiedMessagePipe
                 : messagePipe;
 
@@ -444,6 +444,10 @@ public class Manager implements Closeable {
         }
     }
 
+    private SignalProfile getRecipientProfile(SignalServiceAddress address, Optional<UnidentifiedAccess> unidentifiedAccess, ProfileKey profileKey) throws IOException {
+        return decryptProfile(getEncryptedRecipientProfile(address, unidentifiedAccess), profileKey);
+    }
+
     private Optional<SignalServiceAttachmentStream> createGroupAvatarAttachment(byte[] groupId) throws IOException {
         File file = getGroupAvatarFile(groupId);
         if (!file.exists()) {
@@ -980,7 +984,7 @@ public class Manager implements Closeable {
         }
         SignalProfile targetProfile;
         try {
-            targetProfile = decryptProfile(getRecipientProfile(recipient, Optional.absent()), theirProfileKey);
+            targetProfile = getRecipientProfile(recipient, Optional.absent(), theirProfileKey);
         } catch (IOException e) {
             System.err.println("Failed to get recipient profile: " + e);
             return null;