]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/internal/ManagerImpl.java
Improve identites listing
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / internal / ManagerImpl.java
index e8ab75a4074e1efe92c1ef49003b02b8bbcadf8e..7db22fb21790aabab7366fcb4174f9dbde9407d2 100644 (file)
@@ -1147,7 +1147,12 @@ public class ManagerImpl implements Manager {
 
     @Override
     public List<Identity> getIdentities() {
-        return account.getIdentityKeyStore().getIdentities().stream().map(this::toIdentity).toList();
+        return account.getIdentityKeyStore()
+                .getIdentities()
+                .stream()
+                .map(this::toIdentity)
+                .filter(Objects::nonNull)
+                .toList();
     }
 
     private Identity toIdentity(final IdentityInfo identityInfo) {
@@ -1157,6 +1162,10 @@ public class ManagerImpl implements Manager {
 
         final var address = account.getRecipientAddressResolver()
                 .resolveRecipientAddress(account.getRecipientResolver().resolveRecipient(identityInfo.getServiceId()));
+        if (address.serviceId().isPresent() && !Objects.equals(address.serviceId().get(),
+                identityInfo.getServiceId())) {
+            return null;
+        }
         final var scannableFingerprint = context.getIdentityHelper()
                 .computeSafetyNumberForScanning(identityInfo.getServiceId(), identityInfo.getIdentityKey());
         return new Identity(address.toApiRecipientAddress(),