mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Update dependencies
This commit is contained in:
parent
c78299e7bc
commit
fb85e1a068
2 changed files with 47 additions and 41 deletions
|
@ -6,10 +6,12 @@ import org.asamk.signal.manager.api.TrustLevel;
|
||||||
import org.asamk.signal.manager.storage.SignalAccount;
|
import org.asamk.signal.manager.storage.SignalAccount;
|
||||||
import org.asamk.signal.manager.storage.groups.GroupInfoV1;
|
import org.asamk.signal.manager.storage.groups.GroupInfoV1;
|
||||||
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
|
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
|
||||||
|
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||||
import org.asamk.signal.manager.storage.stickers.StickerPack;
|
import org.asamk.signal.manager.storage.stickers.StickerPack;
|
||||||
import org.asamk.signal.manager.util.AttachmentUtils;
|
import org.asamk.signal.manager.util.AttachmentUtils;
|
||||||
import org.asamk.signal.manager.util.IOUtils;
|
import org.asamk.signal.manager.util.IOUtils;
|
||||||
import org.asamk.signal.manager.util.MimeUtils;
|
import org.asamk.signal.manager.util.MimeUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.signal.libsignal.protocol.IdentityKey;
|
import org.signal.libsignal.protocol.IdentityKey;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -138,42 +140,17 @@ public class SyncHelper {
|
||||||
for (var contactPair : account.getContactStore().getContacts()) {
|
for (var contactPair : account.getContactStore().getContacts()) {
|
||||||
final var recipientId = contactPair.first();
|
final var recipientId = contactPair.first();
|
||||||
final var contact = contactPair.second();
|
final var contact = contactPair.second();
|
||||||
final var address = context.getRecipientHelper().resolveSignalServiceAddress(recipientId);
|
final var address = account.getRecipientAddressResolver().resolveRecipientAddress(recipientId);
|
||||||
|
|
||||||
var currentIdentity = account.getIdentityKeyStore().getIdentityInfo(address.getServiceId());
|
out.write(getDeviceContact(address, recipientId, contact));
|
||||||
VerifiedMessage verifiedMessage = null;
|
|
||||||
if (currentIdentity != null) {
|
|
||||||
verifiedMessage = new VerifiedMessage(address,
|
|
||||||
currentIdentity.getIdentityKey(),
|
|
||||||
currentIdentity.getTrustLevel().toVerifiedState(),
|
|
||||||
currentIdentity.getDateAddedTimestamp());
|
|
||||||
}
|
|
||||||
|
|
||||||
var profileKey = account.getProfileStore().getProfileKey(recipientId);
|
|
||||||
out.write(new DeviceContact(address,
|
|
||||||
Optional.ofNullable(contact.getName()),
|
|
||||||
createContactAvatarAttachment(new RecipientAddress(address)),
|
|
||||||
Optional.ofNullable(contact.color()),
|
|
||||||
Optional.ofNullable(verifiedMessage),
|
|
||||||
Optional.ofNullable(profileKey),
|
|
||||||
contact.isBlocked(),
|
|
||||||
Optional.of(contact.messageExpirationTime()),
|
|
||||||
Optional.empty(),
|
|
||||||
contact.isArchived()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (account.getProfileKey() != null) {
|
if (account.getProfileKey() != null) {
|
||||||
// Send our own profile key as well
|
// Send our own profile key as well
|
||||||
out.write(new DeviceContact(account.getSelfAddress(),
|
final var address = account.getSelfRecipientAddress();
|
||||||
Optional.empty(),
|
final var recipientId = account.getSelfRecipientId();
|
||||||
Optional.empty(),
|
final var contact = account.getContactStore().getContact(recipientId);
|
||||||
Optional.empty(),
|
out.write(getDeviceContact(address, recipientId, contact));
|
||||||
Optional.empty(),
|
|
||||||
Optional.of(account.getProfileKey()),
|
|
||||||
false,
|
|
||||||
Optional.empty(),
|
|
||||||
Optional.empty(),
|
|
||||||
false));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +176,35 @@ public class SyncHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private DeviceContact getDeviceContact(
|
||||||
|
final RecipientAddress address, final RecipientId recipientId, final Contact contact
|
||||||
|
) throws IOException {
|
||||||
|
var currentIdentity = address.serviceId().isEmpty()
|
||||||
|
? null
|
||||||
|
: account.getIdentityKeyStore().getIdentityInfo(address.serviceId().get());
|
||||||
|
VerifiedMessage verifiedMessage = null;
|
||||||
|
if (currentIdentity != null) {
|
||||||
|
verifiedMessage = new VerifiedMessage(address.toSignalServiceAddress(),
|
||||||
|
currentIdentity.getIdentityKey(),
|
||||||
|
currentIdentity.getTrustLevel().toVerifiedState(),
|
||||||
|
currentIdentity.getDateAddedTimestamp());
|
||||||
|
}
|
||||||
|
|
||||||
|
var profileKey = account.getProfileStore().getProfileKey(recipientId);
|
||||||
|
return new DeviceContact(address.aci(),
|
||||||
|
address.number(),
|
||||||
|
Optional.ofNullable(contact == null ? null : contact.getName()),
|
||||||
|
createContactAvatarAttachment(address),
|
||||||
|
Optional.ofNullable(contact == null ? null : contact.color()),
|
||||||
|
Optional.ofNullable(verifiedMessage),
|
||||||
|
Optional.ofNullable(profileKey),
|
||||||
|
contact != null && contact.isBlocked(),
|
||||||
|
Optional.ofNullable(contact == null ? null : contact.messageExpirationTime()),
|
||||||
|
Optional.empty(),
|
||||||
|
contact != null && contact.isArchived());
|
||||||
|
}
|
||||||
|
|
||||||
public SendMessageResult sendBlockedList() {
|
public SendMessageResult sendBlockedList() {
|
||||||
var addresses = new ArrayList<SignalServiceAddress>();
|
var addresses = new ArrayList<SignalServiceAddress>();
|
||||||
for (var record : account.getContactStore().getContacts()) {
|
for (var record : account.getContactStore().getContacts()) {
|
||||||
|
@ -315,19 +321,19 @@ public class SyncHelper {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c == null) {
|
if (c == null || (c.getAci().isEmpty() && c.getE164().isEmpty())) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (c.getAddress().matches(account.getSelfAddress()) && c.getProfileKey().isPresent()) {
|
final var address = new RecipientAddress(c.getAci(), Optional.empty(), c.getE164(), Optional.empty());
|
||||||
|
if (address.matches(account.getSelfRecipientAddress()) && c.getProfileKey().isPresent()) {
|
||||||
account.setProfileKey(c.getProfileKey().get());
|
account.setProfileKey(c.getProfileKey().get());
|
||||||
}
|
}
|
||||||
final var recipientId = account.getRecipientTrustedResolver().resolveRecipientTrusted(c.getAddress());
|
final var recipientId = account.getRecipientTrustedResolver().resolveRecipientTrusted(address);
|
||||||
var contact = account.getContactStore().getContact(recipientId);
|
var contact = account.getContactStore().getContact(recipientId);
|
||||||
final var builder = contact == null ? Contact.newBuilder() : Contact.newBuilder(contact);
|
final var builder = contact == null ? Contact.newBuilder() : Contact.newBuilder(contact);
|
||||||
if (c.getName().isPresent() && (
|
if (c.getName().isPresent() && (
|
||||||
contact == null || (
|
contact == null || (
|
||||||
contact.givenName() == null
|
contact.givenName() == null && contact.familyName() == null
|
||||||
&& contact.familyName() == null
|
|
||||||
)
|
)
|
||||||
)) {
|
)) {
|
||||||
builder.withGivenName(c.getName().get());
|
builder.withGivenName(c.getName().get());
|
||||||
|
@ -354,7 +360,7 @@ public class SyncHelper {
|
||||||
account.getContactStore().storeContact(recipientId, builder.build());
|
account.getContactStore().storeContact(recipientId, builder.build());
|
||||||
|
|
||||||
if (c.getAvatar().isPresent()) {
|
if (c.getAvatar().isPresent()) {
|
||||||
downloadContactAvatar(c.getAvatar().get(), new RecipientAddress(c.getAddress()));
|
downloadContactAvatar(c.getAvatar().get(), address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,16 +10,16 @@ dependencyResolutionManagement {
|
||||||
library("jackson.databind", "com.fasterxml.jackson.core", "jackson-databind").version("2.16.1")
|
library("jackson.databind", "com.fasterxml.jackson.core", "jackson-databind").version("2.16.1")
|
||||||
library("argparse4j", "net.sourceforge.argparse4j", "argparse4j").version("0.9.0")
|
library("argparse4j", "net.sourceforge.argparse4j", "argparse4j").version("0.9.0")
|
||||||
library("dbusjava", "com.github.hypfvieh", "dbus-java-transport-native-unixsocket").version("5.0.0")
|
library("dbusjava", "com.github.hypfvieh", "dbus-java-transport-native-unixsocket").version("5.0.0")
|
||||||
version("slf4j", "2.0.10")
|
version("slf4j", "2.0.12")
|
||||||
library("slf4j.api", "org.slf4j", "slf4j-api").versionRef("slf4j")
|
library("slf4j.api", "org.slf4j", "slf4j-api").versionRef("slf4j")
|
||||||
library("slf4j.jul", "org.slf4j", "jul-to-slf4j").versionRef("slf4j")
|
library("slf4j.jul", "org.slf4j", "jul-to-slf4j").versionRef("slf4j")
|
||||||
library("logback", "ch.qos.logback", "logback-classic").version("1.4.14")
|
library("logback", "ch.qos.logback", "logback-classic").version("1.4.14")
|
||||||
|
|
||||||
library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_94")
|
library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_95")
|
||||||
library("sqlite", "org.xerial", "sqlite-jdbc").version("3.45.1.0")
|
library("sqlite", "org.xerial", "sqlite-jdbc").version("3.45.1.0")
|
||||||
library("hikari", "com.zaxxer", "HikariCP").version("5.1.0")
|
library("hikari", "com.zaxxer", "HikariCP").version("5.1.0")
|
||||||
library("junit.jupiter", "org.junit.jupiter", "junit-jupiter").version("5.10.1")
|
library("junit.jupiter", "org.junit.jupiter", "junit-jupiter").version("5.10.2")
|
||||||
library("junit.launcher", "org.junit.platform", "junit-platform-launcher").version("1.10.1")
|
library("junit.launcher", "org.junit.platform", "junit-platform-launcher").version("1.10.2")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue