From: AsamK Date: Thu, 6 Oct 2022 15:36:09 +0000 (+0200) Subject: Update libsignal-service X-Git-Tag: v0.11.2~2 X-Git-Url: https://git.nmode.ca/signal-cli/commitdiff_plain/1dd22132ffd15cc25fffa62aa765af979c7ae347 Update libsignal-service --- diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 9674f296..2dde3b39 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -14,7 +14,7 @@ repositories { } dependencies { - implementation("com.github.turasa", "signal-service-java", "2.15.3_unofficial_58") + implementation("com.github.turasa", "signal-service-java", "2.15.3_unofficial_59") implementation("com.fasterxml.jackson.core", "jackson-databind", "2.13.4") implementation("com.google.protobuf", "protobuf-javalite", "3.11.4") implementation("org.bouncycastle", "bcprov-jdk15on", "1.70") diff --git a/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java b/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java index b892e935..6450f1f8 100644 --- a/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java +++ b/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java @@ -134,7 +134,8 @@ public class SignalDependencies { serviceEnvironmentConfig.getSignalServiceConfiguration(), Optional.of(credentialsProvider), userAgent, - healthMonitor); + healthMonitor, + true); } @Override @@ -143,7 +144,8 @@ public class SignalDependencies { serviceEnvironmentConfig.getSignalServiceConfiguration(), Optional.empty(), userAgent, - healthMonitor); + healthMonitor, + true); } }; signalWebSocket = new SignalWebSocket(webSocketFactory); diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/StorageHelper.java b/lib/src/main/java/org/asamk/signal/manager/helper/StorageHelper.java index f3c3a091..15684da5 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/StorageHelper.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/StorageHelper.java @@ -109,27 +109,48 @@ public class StorageHelper { final var blocked = contact != null && contact.isBlocked(); final var profileShared = contact != null && contact.isProfileSharingEnabled(); final var archived = contact != null && contact.isArchived(); + final var contactGivenName = contact == null ? null : contact.getGivenName(); + final var contactFamilyName = contact == null ? null : contact.getFamilyName(); if (blocked != contactRecord.isBlocked() || profileShared != contactRecord.isProfileSharingEnabled() - || archived != contactRecord.isArchived()) { + || archived != contactRecord.isArchived() + || ( + contactRecord.getSystemGivenName().isPresent() && !contactRecord.getSystemGivenName() + .get() + .equals(contactGivenName) + ) + || ( + contactRecord.getSystemFamilyName().isPresent() && !contactRecord.getSystemFamilyName() + .get() + .equals(contactFamilyName) + )) { logger.debug("Storing new or updated contact {}", recipientId); final var contactBuilder = contact == null ? Contact.newBuilder() : Contact.newBuilder(contact); final var newContact = contactBuilder.withBlocked(contactRecord.isBlocked()) .withProfileSharingEnabled(contactRecord.isProfileSharingEnabled()) - .withArchived(contactRecord.isArchived()) - .build(); - account.getContactStore().storeContact(recipientId, newContact); + .withArchived(contactRecord.isArchived()); + if (contactRecord.getSystemGivenName().isPresent() || contactRecord.getSystemFamilyName().isPresent()) { + newContact.withGivenName(contactRecord.getSystemGivenName().orElse(null)) + .withFamilyName(contactRecord.getSystemFamilyName().orElse(null)); + } + account.getContactStore().storeContact(recipientId, newContact.build()); } final var profile = account.getProfileStore().getProfile(recipientId); - final var givenName = profile == null ? null : profile.getGivenName(); - final var familyName = profile == null ? null : profile.getFamilyName(); - if ((contactRecord.getGivenName().isPresent() && !contactRecord.getGivenName().get().equals(givenName)) || ( - contactRecord.getFamilyName().isPresent() && !contactRecord.getFamilyName().get().equals(familyName) + final var profileGivenName = profile == null ? null : profile.getGivenName(); + final var profileFamilyName = profile == null ? null : profile.getFamilyName(); + if (( + contactRecord.getProfileGivenName().isPresent() && !contactRecord.getProfileGivenName() + .get() + .equals(profileGivenName) + ) || ( + contactRecord.getProfileFamilyName().isPresent() && !contactRecord.getProfileFamilyName() + .get() + .equals(profileFamilyName) )) { final var profileBuilder = profile == null ? Profile.newBuilder() : Profile.newBuilder(profile); - final var newProfile = profileBuilder.withGivenName(contactRecord.getGivenName().orElse(null)) - .withFamilyName(contactRecord.getFamilyName().orElse(null)) + final var newProfile = profileBuilder.withGivenName(contactRecord.getProfileGivenName().orElse(null)) + .withFamilyName(contactRecord.getProfileFamilyName().orElse(null)) .build(); account.getProfileStore().storeProfile(recipientId, newProfile); }