]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java
Implement more methods for DbusManagerImpl
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / ManagerImpl.java
index 87d3d0d0f8e07ae92b46dab3d614b1cac793dfab..df757a8b92e26f4862d25b13688a7424a90b83de 100644 (file)
@@ -275,7 +275,7 @@ public class ManagerImpl implements Manager {
         try {
             preKeyHelper.refreshPreKeysIfNecessary();
             if (account.getAci() == null) {
-                account.setAci(dependencies.getAccountManager().getOwnAci());
+                account.setAci(ACI.parseOrNull(dependencies.getAccountManager().getWhoAmI().getAci()));
             }
             updateAccountAttributes(null);
         } catch (AuthorizationFailedException e) {
@@ -445,7 +445,7 @@ public class ManagerImpl implements Manager {
                     d.getCreated(),
                     d.getLastSeen(),
                     d.getId() == account.getDeviceId());
-        }).collect(Collectors.toList());
+        }).toList();
     }
 
     @Override
@@ -517,7 +517,7 @@ public class ManagerImpl implements Manager {
 
     @Override
     public List<Group> getGroups() {
-        return account.getGroupStore().getGroups().stream().map(this::toGroup).collect(Collectors.toList());
+        return account.getGroupStore().getGroups().stream().map(this::toGroup).toList();
     }
 
     private Group toGroup(final GroupInfo groupInfo) {
@@ -628,7 +628,7 @@ public class ManagerImpl implements Manager {
                                 .map(sendMessageResult -> SendMessageResult.from(sendMessageResult,
                                         account.getRecipientStore(),
                                         account.getRecipientStore()::resolveRecipientAddress))
-                                .collect(Collectors.toList()));
+                                .toList());
             }
         }
         return new SendMessageResults(timestamp, results);
@@ -657,7 +657,7 @@ public class ManagerImpl implements Manager {
                                 .map(r -> SendMessageResult.from(r,
                                         account.getRecipientStore(),
                                         account.getRecipientStore()::resolveRecipientAddress))
-                                .collect(Collectors.toList()));
+                                .toList());
             }
         }
         return new SendMessageResults(timestamp, results);
@@ -1283,7 +1283,7 @@ public class ManagerImpl implements Manager {
                 .getContacts()
                 .stream()
                 .map(p -> new Pair<>(account.getRecipientStore().resolveRecipientAddress(p.first()), p.second()))
-                .collect(Collectors.toList());
+                .toList();
     }
 
     @Override
@@ -1319,11 +1319,7 @@ public class ManagerImpl implements Manager {
 
     @Override
     public List<Identity> getIdentities() {
-        return account.getIdentityKeyStore()
-                .getIdentities()
-                .stream()
-                .map(this::toIdentity)
-                .collect(Collectors.toList());
+        return account.getIdentityKeyStore().getIdentities().stream().map(this::toIdentity).toList();
     }
 
     private Identity toIdentity(final IdentityInfo identityInfo) {
@@ -1436,13 +1432,13 @@ public class ManagerImpl implements Manager {
 
     private SignalServiceAddress resolveSignalServiceAddress(RecipientId recipientId) {
         final var address = account.getRecipientStore().resolveRecipientAddress(recipientId);
-        if (address.getUuid().isPresent()) {
+        if (address.uuid().isPresent()) {
             return address.toSignalServiceAddress();
         }
 
         // Address in recipient store doesn't have a uuid, this shouldn't happen
         // Try to retrieve the uuid from the server
-        final var number = address.getNumber().get();
+        final var number = address.number().get();
         final ACI aci;
         try {
             aci = getRegisteredUser(number);