]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java
Adapt log level when using system locale
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / ManagerImpl.java
index daff69e026973b2f71b93b22ea2a92e9555f0dc1..7b09aa3ef55593856054be70d72d8ada2014fd06 100644 (file)
@@ -232,6 +232,7 @@ class ManagerImpl implements Manager {
             context.getAccountHelper().setDeviceName(deviceName);
         }
         context.getAccountHelper().updateAccountAttributes();
+        context.getAccountHelper().checkWhoAmiI();
     }
 
     @Override
@@ -563,7 +564,8 @@ class ManagerImpl implements Manager {
             final var quote = message.quote().get();
             messageBuilder.withQuote(new SignalServiceDataMessage.Quote(quote.timestamp(),
                     context.getRecipientHelper()
-                            .resolveSignalServiceAddress(context.getRecipientHelper().resolveRecipient(quote.author())),
+                            .resolveSignalServiceAddress(context.getRecipientHelper().resolveRecipient(quote.author()))
+                            .getServiceId(),
                     quote.message(),
                     List.of(),
                     resolveMentions(quote.mentions()),
@@ -650,7 +652,7 @@ class ManagerImpl implements Manager {
         var targetAuthorRecipientId = context.getRecipientHelper().resolveRecipient(targetAuthor);
         var reaction = new SignalServiceDataMessage.Reaction(emoji,
                 remove,
-                context.getRecipientHelper().resolveSignalServiceAddress(targetAuthorRecipientId),
+                context.getRecipientHelper().resolveSignalServiceAddress(targetAuthorRecipientId).getServiceId(),
                 targetSentTimestamp);
         final var messageBuilder = SignalServiceDataMessage.newBuilder().withReaction(reaction);
         return sendMessage(messageBuilder, recipients);
@@ -705,12 +707,13 @@ class ManagerImpl implements Manager {
 
     @Override
     public void setContactName(
-            RecipientIdentifier.Single recipient, String name
+            RecipientIdentifier.Single recipient, String givenName, final String familyName
     ) throws NotPrimaryDeviceException, UnregisteredRecipientException {
         if (!account.isPrimaryDevice()) {
             throw new NotPrimaryDeviceException();
         }
-        context.getContactHelper().setContactName(context.getRecipientHelper().resolveRecipient(recipient), name);
+        context.getContactHelper()
+                .setContactName(context.getRecipientHelper().resolveRecipient(recipient), givenName, familyName);
     }
 
     @Override
@@ -829,9 +832,7 @@ class ManagerImpl implements Manager {
     }
 
     void retrieveRemoteStorage() throws IOException {
-        if (account.getStorageKey() != null) {
-            context.getStorageHelper().readDataFromStorage();
-        }
+        context.getStorageHelper().readDataFromStorage();
     }
 
     @Override
@@ -859,7 +860,8 @@ class ManagerImpl implements Manager {
             logger.debug("Starting receiving messages");
             context.getReceiveHelper().receiveMessagesContinuously((envelope, e) -> {
                 synchronized (messageHandlers) {
-                    Stream.concat(messageHandlers.stream(), weakHandlers.stream()).forEach(h -> {
+                    final var handlers = Stream.concat(messageHandlers.stream(), weakHandlers.stream()).toList();
+                    handlers.forEach(h -> {
                         try {
                             h.handleMessage(envelope, e);
                         } catch (Throwable ex) {
@@ -987,6 +989,9 @@ class ManagerImpl implements Manager {
                 return null;
             }
         }).filter(Objects::nonNull).collect(Collectors.toSet());
+        if (!recipients.isEmpty() && recipientIds.isEmpty()) {
+            return List.of();
+        }
         // refresh profiles of explicitly given recipients
         context.getProfileHelper().refreshRecipientProfiles(recipientIds);
         return account.getRecipientStore().getRecipients(onlyContacts, blocked, recipientIds, name);
@@ -1047,7 +1052,7 @@ class ManagerImpl implements Manager {
         IdentityInfo identity;
         try {
             identity = account.getIdentityKeyStore()
-                    .getIdentity(context.getRecipientHelper().resolveRecipient(recipient));
+                    .getIdentityInfo(context.getRecipientHelper().resolveRecipient(recipient));
         } catch (UnregisteredRecipientException e) {
             identity = null;
         }